I ve written a code and there is one small query, how do i stop writing into this text file when i see TER and then continue with rest of the function my code is :
Code:
void ProcessFile(char fileName[])
{
int i;
FILE *rfile;
FILE *wfile;
char writeFileName[30], readLine[80];
if ((rfile = fopen (fileName,"r")) == NULL)
{
perror(fileName);
printf("Exiting program!");
//getch();
exit(1);
}
else
{
CutAndPasteString(writeFileName, ".pdb", ".rtf", fileName);
wfile = fopen (writeFileName, "w");
while(!feof(rfile))
{
fgets(readLine, sizeof(readLine), rfile);
if(readLine[0] == 'A' && readLine[1] == 'T' && readLine[2] == 'O' && readLine[3] == 'M')
{
if (CheckForValues(readLine))
{
//printf("%c\n", readLine[13]);
fputs(readLine, wfile);
if (strlen(readLine) < 80)
{
for (i=0;i<(80 - strlen(readLine));i++)
fputc(' ', wfile);
}
fputs("\n", wfile);
}
}
else if (readLine [0] == 'T' && readLine[1] == 'E' && readLine[2] =='R' )
}
fclose(wfile);fclose(rfile);
ReadingFiles0(0, writeFileName, "cp4.txt");
ReadingFiles1(0, writeFileName, "cpc4.txt");
ReadingFiles2(0, writeFileName, "cpcp4.txt");
}
return;
}
i want to stop writing into the output file after the condition which i ve highlighted in red, n then proceed with function reading file. how do i do that ?
If i give exit (0);
it exits the whole function how do i sort this ?
please help me.