0

This is the code that I was working on, I need it to read one character from a text file at a time and then delete it but I'm sure how to delete it once it is read? Please can some one help

char readfromtf()
{
FILE *tf = fopen("string.txt", "r+");
char c;


if(tf == NULL) 
{
  perror("Error in opening file");
  return(-1);
}
else
{
  c = fgetc(tf);
  if (c == EOF)
  {
    fclose(tf);
    return 'x';

  } else 
  {
    fclose(tf);
    return c;

  }

 }

}
4

0 に答える 0