Code:
#include<stdio.h>
#include <stdlib.h>
#include <iostream>
int main(int argc, char* argv[])
{
FILE *ptr_mail,*out;
char sentence[1000];
char sent[1000];
int i=0,pos=1;
ptr_mail =fopen(argv[1],"r");
if (!ptr_mail)
{
return 1;
}
//gets input from file prints by the sentence until AT_EOS
while (fgets(sentence,1000, ptr_mail)!=NULL)
{
if(sentence[i]=='F'&& sentence[i+1]=='r' &&sentence[i+2]=='o'&&sentence[i+3]=='m' && sentence[i+4]==' ' )
{
//alright I think I have fprintf working now I cant figure out the syantx to put it to the Isteam or just a file.
out = fopen(output.txt, "w");
if(out != NULL)
{
fprintf(out,"%d",pos);
fprintf(out," ");
fprintf(out,"%s",sentence);
}
//need to figure out how to put it to output file
pos++;
}
}
fclose(ptr_mail);
return 0;
}