Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Linuxmania Linuxmania is offline
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



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 09:41 PM.


no new posts