I am trying to get the substring or line at a given position.
#include <stdio.h>
int main ()
{
FILE * pFile;
pFile = fopen ( "example.tx t" , "w" );
fputs ( "This is an apple.\nWhat can be done on the apple\n" , pFile );
fseek ( pFile , 11, SEEK_SET);
fclose ( pFile );
return 0;
}
using seekg we can point to a particular position but i need substring which ends with newline after the position.
In the above case
I need output should be
apple.\n
How this can be implemented.Tha nks in advance.
Manish
#include <stdio.h>
int main ()
{
FILE * pFile;
pFile = fopen ( "example.tx t" , "w" );
fputs ( "This is an apple.\nWhat can be done on the apple\n" , pFile );
fseek ( pFile , 11, SEEK_SET);
fclose ( pFile );
return 0;
}
using seekg we can point to a particular position but i need substring which ends with newline after the position.
In the above case
I need output should be
apple.\n
How this can be implemented.Tha nks in advance.
Manish
Comment