0

i have read a txt file into queue just like below example which is i can do it.. the problem is i how to read Tab Delimited Files which i want file size to multiple by 0.6... because i want to create handle a printer simulation using queue...sorry for my english

Name of File   Time accepted   File size (KB)
Exercise.cpp    8.00 am     1.2
Report.doc      8.00 am     3.4
Test.doc        8.10 am     5.0
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by PuQimX
0

If you have three columns and the delimiter is a tab, I imagine the best way to handle it is to read the whole line, then use the find_first_of function from the string library with a '\t' as the character to look for. That returns the index of the tab, then you use the substr function from the string library to get the strings before and after that tab. Repeat this again to get the second tab. You'll end up with two tab indexes, which tell you where to break the string into substrings. Do that, throw the tabs away, keep the string.

Another option is to use getline with a tab delimiter instead of a '\n' delimiter as you read in the file.

0

thank you for your help... i already get the solution using ur method.. thanks for google...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.