csv problem

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: csv problem

 
0
  #11
Mar 30th, 2007
Originally Posted by squinx22 View Post
:eek:I still cant understand. can you sate a sample pls? thanx..
Hmmmm, looks like you're tryin to run and you can't walk yet...

Originally Posted by squinx22 View Post
i am just a beginner and using c++ just 3 days ago. i hope you understand.. thanks..
Yep, I understand. As Sir Dragon said, this task seems to be beyond your capabilities. You don't seem to have the basics of looking at a string and figuring out what's in it yet. Back up to previous lessons and get to know strings.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 61
Reputation: squinx22 is an unknown quantity at this point 
Solved Threads: 0
squinx22 squinx22 is offline Offline
Junior Poster in Training

Re: csv problem

 
0
  #12
Mar 30th, 2007
Originally Posted by WaltP View Post
Hmmmm, looks like you're tryin to run and you can't walk yet...


Yep, I understand. As Sir Dragon said, this task seems to be beyond your capabilities. You don't seem to have the basics of looking at a string and figuring out what's in it yet. Back up to previous lessons and get to know strings.
are there any function that trims out the string after the delimiter?

for example

1234, eyryrte
3132, fjifjisj12
1312, fasfaas

I want to erase the data on and after the comma each line, so that the remaining string would be 1234.. I want also to save that in a temporary file for later use..
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 61
Reputation: squinx22 is an unknown quantity at this point 
Solved Threads: 0
squinx22 squinx22 is offline Offline
Junior Poster in Training

Re: csv problem

 
0
  #13
Mar 30th, 2007
help me pls.. i cant work it out....
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: csv problem

 
0
  #14
Mar 30th, 2007
Originally Posted by squinx22 View Post
are there any function that trims out the string after the delimiter?
Yes, there is/are always function(s) that do what you want..
RTFM is what others are trying to tell you very politely.. here is what I found for you on google.. Methods of interest for you would be, find_first_of(), substr()...
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 61
Reputation: squinx22 is an unknown quantity at this point 
Solved Threads: 0
squinx22 squinx22 is offline Offline
Junior Poster in Training

Re: csv problem

 
0
  #15
Mar 30th, 2007
Originally Posted by thekashyap View Post
Yes, there is/are always function(s) that do what you want..
RTFM is what others are trying to tell you very politely.. here is what I found for you on google.. Methods of interest for you would be, find_first_of(), substr()...
i have one more problem..

i want to get the string to certain line in a csv file for comparison purposes.. here's the example:

213,wqeeq,213123,qweq
12,33123,31231,qerq
rdqa,313,442,df
34,dq,423,dfa

i want to get only the 3rd line and discard the other.
what should be the syntax im going to use?

pls help me.. thanx
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,381
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1466
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: csv problem

 
0
  #16
Mar 30th, 2007
if you want to read the 3d line, or any other line, in a file, just count the lines as they are being read and stop when you get to the line you want. You have to read text files sequentually -- from start to finish. If you don't know how to read a file then search the code cnippets for examples because I know they exist there.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: csv problem

 
0
  #17
Mar 30th, 2007
Search the web to find how to read contents of a file line-by-line using a loop.
Once you have that in place, inside the loop, once you've read one line, split the required information using functions given in previous posts.
Using this information figure out if you this is the line you want or not. If this is NOT the line just go ahead read the next line and repeat process. If this is THE line do what you want.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC