chandra1977
asked on
reading from a text file one line at a time...
hi...
I need to read from a file :(presumed as strings..)
e.g:
20031030154545
20031030164545
....
....
get each line and manipulate it and print the output as say(say decrement by 3 hrs it..)
20031030124545
20031030134545
...
what i am basically doing is pass each line to a function that converts the string in to a Date object ..and print it..
I am getting some garbage values...
Any help would be appreciated...regards
code:
char buffer[14];
ifstream file("filename.txt");
while(!file.eof()){
file.getline(filename,14);
//strToDate converts the string int to date object...
Date date = strToDate(buffer);
...
}
I need to read from a file :(presumed as strings..)
e.g:
20031030154545
20031030164545
....
....
get each line and manipulate it and print the output as say(say decrement by 3 hrs it..)
20031030124545
20031030134545
...
what i am basically doing is pass each line to a function that converts the string in to a Date object ..and print it..
I am getting some garbage values...
Any help would be appreciated...regards
code:
char buffer[14];
ifstream file("filename.txt");
while(!file.eof()){
file.getline(filename,14);
//strToDate converts the string int to date object...
Date date = strToDate(buffer);
...
}
ASKER
please delete the question i have posted..i haved mistakenly posted it twice...
https://www.experts-exchange.com/questions/20783484/reading-from-a-text-file-one-line-at-a-time.html#9654131
regards,
sai
https://www.experts-exchange.com/questions/20783484/reading-from-a-text-file-one-line-at-a-time.html#9654131
regards,
sai
ASKER
bcl,
Thats not the solution i was looking for...i have mistyped the variable...hoped u had a better soln to offer..cheers
Thats not the solution i was looking for...i have mistyped the variable...hoped u had a better soln to offer..cheers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: bcladd {http:#9656845}
Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Tinchos
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: bcladd {http:#9656845}
Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Tinchos
EE Cleanup Volunteer
file.getline(buffer, 14);
Also, you want to delete the other copy of this question that got posted. You can look in the CS (community support) section for directions.
-bcl