-
text line termination
How do I remove a line of text in a text file pointed to by a FILE pointer without removing any other text.
i,ve got.
FILE f_ptr;
f_ptr-fopen("filename","a+")
fseek(f_ptr,0,SEEK_SET); /* file beginning */
/* need to remove line of text here and move all subsequent lines up by a line or write to this removed line space later in prog */
thx for the help.
-
Depends what you are reading is it an array of strings or structure post the remainder of your code so we can see.
-
if you wanna remove a line of text first of all declare file like this
Code:
FILE *fileptr = fopen("file.txt","r+");/* Allows you to read and write to a file.*/
Then find the start of the line you want and do want you want to do.
-
Or try this psuedocode:
for(...Iteration... )
{ fgets(Array,Size,FILE* ); }
//close file
//...declare another array...copy selectively... //
for(...Iteration... )
{ ...Print New Array... }