include<stdio.h>
#include<string.h>
int main()
{
// FILE *fopen(const char *path, const char *mode);
FILE *fp;
char *str ="jianglongjie henshuai";
char readBuf[128] = {0};
// FILE *fopen(const char *path, const char *mode);
//ptr buf
//size sizeof char
//geshu
//which file
fp= fopen("./jianglongjie.txt","w+" );
// size_t fwrite(const void *ptr, size_t size, size_t nmemb,
// FILE *stream);
fwrite(str,sizeof(char),strlen(str),fp);
// int fseek(FILE *stream, long offset, int whence);
fseek(fp,0,SEEK_SET);
// ssize_t read(int fd, void *buf, size_t count);
fread(readBuf,sizeof(char),strlen(str),fp);
printf("read data : %s\n",readBuf);
return 0;
}
~
~
~
~
~
c标准库中的读写、光标操作