📄 test.c
字号:
Function name: fread
Function: read a data from the datastream
Usage: int fread(void *ptr, int size, int nitems, FILE *stream);
Example:
#include <string.h>
#include <stdio.h>
int main(void)
{
FILE *stream;
char msg[] = "this is a test";
char buf[20];
if ((stream = fopen("DUMMY.FIL", "w+")) == NULL)
{
fprintf(stderr, "Cannot open output file.\n");
return 1;
}
fwrite(msg, strlen(msg)+1, 1, stream);
fseek(stream, SEEK_SET, 0);
fread(buf, strlen(msg)+1, 1, stream);
printf("%s\n", buf);
fclose(stream);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -