ÏÂÃæµÄº¯ÊýµÄº¯Êý¹¦ÄÜ£ºÒ»´Î¶Áдһ¸ö×Ö·û£¬µ¥¸ö×Ö·ûµÄ¶Áдº¯Êý
1¡¢fgetc()º¯Êý int fgetc(FILE *stream);
º¯Êý·µ»ØÖµ£º fgetc()»á·µ»Ø¶ÁÈ¡µ½µÄ×Ö·û£¬Èô·µ»ØEOFÔò±íʾµ½ÁËÎļþβ¡£
2¡¢fputc()º¯Êý int fputc(int c, FILE *stream);
3¡¢getc()º¯Êý int getc(FILE *stream); µÈͬÓÚfgetc(FILE* stream)
4¡¢putc()º¯Êý int putc(int c, FILE *stream); µÈͬÓÚ fputc(intc, FILE* stream)
º¯Êý˵Ã÷£ºÊäÈ뺯ÊýÔò±íʾ´ÓÎļþÖлñÈ¡Ò»¸ö×Ö·û
Êä³öº¯ÊýÔò±íʾ½«Ò»¸ö×Ö·ûÊä³öµ½ÎļþÖÐ
¶ÔÓÚµÈͬÓÚµÄÓï¾ä£¬Ç°ÕßÊÇÒ»¸öºê£¬ºóÕßÊǺ¯Êý£¬ÓÃÇ°Óú󶼿ÉÒÔ
ʾÀý£º
#include<stdio.h>
int main()
{
char ch;
FILE *fp =fopen("a.txt", "r+");
ch = fgetc(fp);
printf("ch =%c\n", ch);
fputc('B', fp);
fclose(fp);
return 0;
}
×¢Ò⣺fgetc£¬fputc£¬getc£¬putc£¬º¯Êý¶¼ÊÇ´ÓÎļþÁ÷£¬»òÕßÖ±½Ó˵ÎļþÖжÁдÊý¾Ý£¬getchar£¬ putchar()º¯Êý´Ó±ê×¼ÊäÈëÊä³öÁ÷ÖжÁдÊý¾Ý
5¡¢getchar()º¯Êý int getchar(void); µÈͬÓÚfgetc(stdin);
º¯Êý¹¦ÄÜ£ºÓÃÓÚ´Ó¼üÅÌÊäÈë×Ö·û£¬×Ö·ûÊäÈ뺯Êý
ÔòÐèÒª¶¨ÒåÒ»¸ö×Ö·û±äÁ¿È¥½ÓÊÕ´Ó¼üÅÌÊäÈëµÄ×Ö·û
char c; c=getchar()
6¡¢putcha()º¯Êý int putchar(int c); µÈͬÓÚ fputc(intc, stdout)
º¯Êý¹¦ÄÜ£ºÓÃÓÚÔÚÖÕ¶ËÏÔʾ×Ö·û
putchar()À¨ºÅÀïÃæ¿ÉÒÔÊÇ×Ö·û±äÁ¿£¬Ò²¿ÉÒÔÊÇ×Ö·û³£Á¿
»òÕßÕûÐÍÊý¾Ý(´ú±í×Ö·ûµÄÊý¾Ý)