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

Recommended Answers

All 2 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.