mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-04 17:26:32 +08:00
init
This commit is contained in:
17
test/file.c
Normal file
17
test/file.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user