week14
1.今日課程:寫檔fprintf()、讀檔fscanf()、寫檔fprintf()+project、讀檔fscanf()+project
1.1 程式碼:#include<stdio.h>
int main()
{
///檔案指標fout 開啟檔案(檔名,write模式)
FILE * fout = fopen("write.txt","w+");
printf("Hello world\n");
fprintf(fout,"Hello world\n");
fclose(fout);
}
1.2 程式碼:#include<stdio.h>
int main()
{
///檔案指標fout 開啟檔案(檔名,write模式)
FILE * fout = fopen("file.txt","w+");
fprintf(fout,"3.1415926\n");
fclose(fout);///關檔
float angle =0;
FILE * fin=fopen("file.txt","r");
fscanf(fin,"%f",&angle);///沒加&會當
printf("讀到了角度:%f",angle);
fclose(fin);
}
1.3 加上my read 按下鍵盤r可以撥放音樂
#include <opencv/highgui.h>
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
沒有留言:
張貼留言