Hello all:
I used to use C to do the scientific calculation. When I need to read a data file "datafile.txt" into an array "data[]", the following is available:
Use the script above, the data can be only one column.Code:FILE *fp; if((fp=fopen("0date6y.txt", "r"))==NULL) { printf("can not open file date\n"); return; } for(i=0; i<=M1; i++) fscanf(fp,"%s", &dt); //M1: elements of data
If the data file has three columns, can I use C++ script to read the 2nd or 3rd column?
Thanks!