| | |
csv problem
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
•
•
:eek:I still cant understand. can you sate a sample pls? thanx..
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
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
•
•
Join Date: Mar 2007
Posts: 61
Reputation:
Solved Threads: 0
•
•
•
•
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..
•
•
•
•
are there any function that trims out the string after the delimiter?
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()...
•
•
Join Date: Mar 2007
Posts: 61
Reputation:
Solved Threads: 0
•
•
•
•
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 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
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.
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.
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.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Why NOT void main()
- Next Thread: Function prototype?? Help
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






