mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-04 17:26:32 +08:00
17 lines
362 B
C
17 lines
362 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
int main(){
|
|
FILE *fp = fopen("example.txt","r+");
|
|
if(fp == NULL){
|
|
printf("error,cannot open file");
|
|
return 1;
|
|
}
|
|
char buffer[100];
|
|
fread(buffer,sizeof(char),100,fp);
|
|
printf("%s\n",buffer);
|
|
char *wt = "hello, World1!";
|
|
fwrite(wt,sizeof(char),strlen(wt),fp);
|
|
|
|
fclose(fp);
|
|
} |