1.函数fputc;
函数原型:
int fputc(int c, FILE *stream);
返回值:如果没有发生错误,则返回被写入的字符。如果发生错误,则返回 EOF,并设置错误标识符。
c -- 这是要被写入的字符。该字符以其对应的 int 值进行传递。
stream -- 这是指向 FILE 对象的指针,该 FILE 对象标识了要被写入字符的流。
注意:该函数是一个字符一个字符的写进的,并不是一串一串的写,还有其实这个函数跟write是一样的,就是将字符写进文件的意思。
上代码:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
int main()
{