Login to Website

Login dengan Facebook

 

Post Reply
Thread Tools
  #1  
Old 20th November 2011
Linuxmania
Ceriwiser
 
Join Date: Nov 2011
Posts: 392
Rep Power: 14
Linuxmania mempunyai hidup yang Normal
Default [bonus GRP] cara baca file .csv dengan bahasa C

urgent nih all

saya ditugaskan untuk buat coding pake bahasa C buat baca file .csv



saya udh coba buat kaya gini




Quote:





#include

#include

#include

#include



void main()

{

char temp[150][150];

char waktu[150][150];

float price[150];

char signal[150][5];

int volume[150];

int akhir;

int i,j=0;

char *p;



FILE *in;



in=fopen("Backtest_prototype.csv","r");





while(!feof(in))

{



fgets(temp[i],strlen(temp[i])+1,in);



p=strtok(temp[i],",");

strcpy(waktu[i],p);



p=strtok(NULL,",");

price[i]=atof(p);



p=strtok(NULL,",");

strcpy(signal[i],p);



p=strtok(NULL,",");

volume[i]=atoi(p);



i++;

}

fclose(in);





for(j=0;jhttp://www.4*shared.com/file/u2je0L5x/Backtest_prototype.html

saya cuma mau masukkin 1 1 filenya ke array, nanti saya proses

trus ntar hasilnya dimasukkin ke file CSV itu juga



dan sesuai judul buat masing2 yang bantuin saya kasih 1 GRP gratis buat penghargaan saya atas usahanya

makasih all



Sponsored Links
Space available
Post Reply




Switch to Mobile Mode

no new posts