เรื่อง File อ่ะครับ คือผมต้องการจะเขียนเลข 5 ลงในไฟล์ แต่พอรันแล้วมันขึ้น error
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
D:\Programming\Project\14.1ttt.c||In function 'main'
D:\Programming\Project\14.1ttt.c|8|warning: passing argument 1 of 'fwrite' makes pointer from integer without a cast [-Wint-conversion]|
C:\Program Files (x86)\CodeBlocks\MinGW\include\stdio.h|413|note: expected 'const void *' but argument is of type 'int'|
||=== Build finished: 0 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|
#include<stdio.h>
int main() {
FILE *fp;
int num = 5;
fp = fopen( "file2.txt" , "w" );
fwrite(num , sizeof(int) , 1 , fp );
fclose(fp);
return(0);
}
ภาษา C ช่วยดู Code ให้ทีครับผิดตรงไหน (File)
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
D:\Programming\Project\14.1ttt.c||In function 'main'
D:\Programming\Project\14.1ttt.c|8|warning: passing argument 1 of 'fwrite' makes pointer from integer without a cast [-Wint-conversion]|
C:\Program Files (x86)\CodeBlocks\MinGW\include\stdio.h|413|note: expected 'const void *' but argument is of type 'int'|
||=== Build finished: 0 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|
#include<stdio.h>
int main() {
FILE *fp;
int num = 5;
fp = fopen( "file2.txt" , "w" );
fwrite(num , sizeof(int) , 1 , fp );
fclose(fp);
return(0);
}