Darkness Let there be light Go Wide
Login problems?
Go Back   Erodov: India's Tech Forum > Software Zone > Languages



Languages The various programming languages.

Reply
 
LinkBack Thread Tools Display Modes
Old 10-28-2008, 12:26 PM   #1
teh priesT!
 
apextwin's Avatar
 
Join Date: Feb 2008
Location: Delhi,Mysore
Posts: 696
Rep Power: 23
apextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirable
 
[E] Trader Rating: (+0)
 
My Photos: (0)

Mr Veg!

Reading a CSV File


Stumble Upon!
Does anyone have a simple code for this ? C++ is way out of my league as i hvnt touched this language in over 4 years or more ..
Any help will be highly appreciated ..
__________________
------------------------------------------------

This space for Rent

------------------------------------------------
Buri nazar walle tera muh kalla
apextwin is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-28-2008, 12:30 PM   #2
teh priesT!
 
sahilm's Avatar
 
Join Date: Mar 2008
Location: Noida
Posts: 827
Rep Power: 33
sahilm is simply Great
sahilm is simply Greatsahilm is simply Greatsahilm is simply Great
 
[E] Trader Rating: (+2)
 
My Photos: (13)

Mr Non Veg!

Re: Reading a CSV File

1. The hint is in the file extension.
2. Loop through the file.
3. Stop at commas and process.
__________________
I can see much clearer now, I'm blind.
sahilm is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-28-2008, 03:51 PM   #3
teh priesT!
 
apextwin's Avatar
 
Join Date: Feb 2008
Location: Delhi,Mysore
Posts: 696
Rep Power: 23
apextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirable
 
[E] Trader Rating: (+0)
 
My Photos: (0)

Mr Veg!

Re: Reading a CSV File

I knw the method but its just the fact that i would have to learn the VC++ all over again .. Being lazy dsnt help also .. So if someone has it then no it would make my life a lot easier
__________________
------------------------------------------------

This space for Rent

------------------------------------------------
Buri nazar walle tera muh kalla
apextwin is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-28-2008, 04:59 PM   #4
Microphone abuser!
 
montylee's Avatar
 
Join Date: Aug 2007
Location: Orange County, California
Posts: 2,461
Rep Power: 65
montylee is extemely Distinguished
montylee is extemely Distinguishedmontylee is extemely Distinguishedmontylee is extemely Distinguishedmontylee is extemely Distinguished
 
[E] Trader Rating: (+3)
 
My Photos: (32)

Mr Non Veg!

Send a message via Yahoo to montylee
Re: Reading a CSV File

u can use strtok() function to get tokens separated by commas.
montylee is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-28-2008, 05:01 PM   #5
teh priesT!
 
apextwin's Avatar
 
Join Date: Feb 2008
Location: Delhi,Mysore
Posts: 696
Rep Power: 23
apextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirable
 
[E] Trader Rating: (+0)
 
My Photos: (0)

Mr Veg!

Re: Reading a CSV File

^ Yeah i was reading that .. could u perhaps explain wat does it excatly mean ? ..
Also could u guys tell me which VC++ project type should i select for this .. I dont want any output so Win32 is out ..
__________________
------------------------------------------------

This space for Rent

------------------------------------------------
Buri nazar walle tera muh kalla
apextwin is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-29-2008, 01:22 AM   #6
Microphone abuser!
 
montylee's Avatar
 
Join Date: Aug 2007
Location: Orange County, California
Posts: 2,461
Rep Power: 65
montylee is extemely Distinguished
montylee is extemely Distinguishedmontylee is extemely Distinguishedmontylee is extemely Distinguishedmontylee is extemely Distinguished
 
[E] Trader Rating: (+3)
 
My Photos: (32)

Mr Non Veg!

Send a message via Yahoo to montylee
Re: Reading a CSV File

no idea about VC++. About strtok(), check out some examples from the internet. Here's a brief info:

suppose you have a file which has the following contents:

a,b,c,d,e

now, you want to read individual tokens separated by comma. Tokens are simply values that are separated by commas, for e.g. a b c etc...

now, you can use strtok to get the tokens as follows:

Quote:
First read the file and get the current line (maybe using fgets) into array line
char *token;
token = strtok (line, ",");
while (token != NULL) {
token = strtok (NULL, ",");
}
So, to get the tokens you have to call strtok 2 times. Once with the array argument containing the contents to be parsed and then again with NULL argument. The 2nd argument is the token separator (comma in ur case).

I hope this helps...
montylee is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-29-2008, 03:14 PM   #7
teh priesT!
 
apextwin's Avatar
 
Join Date: Feb 2008
Location: Delhi,Mysore
Posts: 696
Rep Power: 23
apextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirableapextwin is highly Admirable
 
[E] Trader Rating: (+0)
 
My Photos: (0)

Mr Veg!

Re: Reading a CSV File

Thanks monty .. I had some trouble implementing Strok with all these complier options in VC++ .. It worked but now i am using a string split function in VC++ ..
Maybe we should have a code library in Erodov for such commonly used functions
__________________
------------------------------------------------

This space for Rent

------------------------------------------------
Buri nazar walle tera muh kalla
apextwin is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-31-2008, 01:51 AM   #8
teh smartie pantS!
 
CompanionCube's Avatar
 
Join Date: Feb 2008
Location: Hyderabad/cp_gravelpit
Posts: 396
Rep Power: 22
CompanionCube is highly AdmirableCompanionCube is highly AdmirableCompanionCube is highly AdmirableCompanionCube is highly AdmirableCompanionCube is highly AdmirableCompanionCube is highly AdmirableCompanionCube is highly AdmirableCompanionCube is highly AdmirableCompanionCube is highly Admirable
 
[E] Trader Rating: (+0)
 
My Photos: (0)

Mr Veg!

Send a message via Yahoo to CompanionCube
Re: Reading a CSV File

^^In VC++, File->New->Project->Win32->"Win32 Console Application" for all the console/dos applications.
__________________
CPU: Core 2 Duo E8400 @ stock settings with stock cooler
Mobo: Gigabyte GA-EP35C-DS3R rev 2.1
RAM: 2GB Transcend DDR2 800Mhz (5-5-5)
GPU: BFG Geforce 6600GT GDDR3 OC Edition (needs an upgrade)

If you feel you have been exposed to radioactive or other hazardous materials in the course of your duties, contact your Radiation Safety Officer immediately!

CompanionCube is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 04:50 PM.


Custom Theme created by Ad1tya
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Ad Management by RedTyger