Карта сайта Интеллектуальная поисковая системаДобавить свою ссылку по ключевому запросуПоисковая система v3.kz поможет ускорить индексацию вашего сайта выводит в Топ |
|
4641418. If the end of file is reached without reading any characters, fgets is obliged to return NULL. Anyway, you could check feof(fd) after fgets didnt read anything. Its ch = fgetc(fp); not ch = fgetc(). Besides that.. any reason why you cant use fgets()? fgets(3) - Linux man page. Name. fgetc, fgets, getc, getchar, gets, ungetc - input of characters and strings. При достижении конца файла функция fgetc() возвращает EOF. Однако поскольку EOF — действительное целое число, то при работе с двоичными файлами для обнаружения конца файла необходимо использовать feof(). If the end-of-file is encountered while attempting to read a character, the eof indicator is set (feof). If this happens before any characters could be read, the pointer returned is a null pointer (and the contents of str remain unchanged). fgetc() reads the next character from stream and returns it as an. unsigned char cast to an int, or EOF on end of file or error. You are using fgetc() which returns EOF when the end of file is reached, so use that. fgets ◄. fgetc() reads the next character from stream and returns it as an unsigned char cast to an int, or EOF on end of file or error. fgetc() reads the next character from stream and returns it as an unsigned char cast to an int, or EOF on end of file or error. Информация взята v3.kz |
загрузка...
|