C---讀取數據
阿新 • • 發佈:2017-11-03
tails int detail 報錯 sta .net sdn top glob
參考:http://blog.csdn.net/js_xj/article/details/5863734
#include <stdio.h> #include <string.h> int main() { char buf[]="Golden Global View"; char* token = strtok(buf, " "); while(token != NULL) { printf("%s\n", token); token = strtok(NULL, " "); }return 0; }
寫成這樣就報錯了
int read(){ FILE* fp; fp = fopen("C:\\Users\\Administrator\\Desktop\\tiaoshi\\example.txt","r"); char* token = strtok(fp," ");//mistake while(token!=NULL){ printf("%s",token); token = strtok(NULL,","); } return 0; }
C---讀取數據