请输入您要查询的百科知识:

 

词条 fgetc
释义

§ 解释

函数名: fgetc

功 能: 从流中读取字符

用 法: int fgetc(FILE *stream);

§ 程序例

#include <string.h>

#include <stdio.h>

#include <conio.h>

int main(void)

{

FILE *stream;

char string【】 = "This is a test";

char ch;

/* open a file for update */

stream = fopen("DUMMY.FIL", "w+");

/* write a string into the file */

fwrite(string, strlen(string), 1, stream);

/* seek to the beginning of the file */

fseek(stream, 0, SEEK_SET);

do

{

/* read a char from the file */

ch = fgetc(stream);

/* display the character */

putch(ch);

} while (ch != EOF);

fclose(stream);

return 0;

}

随便看

 

百科全书收录594082条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2024/11/11 9:23:31