0

这是我正在处理的代码,我需要它一次从文本文件中读取一个字符然后删除它,但我确定一旦读取它如何删除它?请有人帮忙

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