The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Read a file line by line VENC22 UNIX for Dummies Questions & Answers 4 10-30-2008 11:09 AM
read the file line by line kittusri9 Shell Programming and Scripting 3 04-24-2008 09:26 AM
How to read last line of a txt file? yongho UNIX for Dummies Questions & Answers 2 06-13-2005 02:20 PM
read line from file rein Shell Programming and Scripting 5 04-15-2005 03:32 AM
How to read from a file line by line and do stuff spaceship Shell Programming and Scripting 4 03-17-2005 09:47 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-19-2008
ahjiefreak ahjiefreak is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 132
How to read element of line of file

Hi,

I would like to get elements in data in a file.

My file data would be something like:-

foo 123.32 323 4356.234 22344.9
fon 234.454 3434 2362.3 34

...etc..

I would like to read the elements in this file each line by line and write onto another text file.

I am using getline to get these data from line by line basis. However, for element basis, I would like to use istream_iterator vector to store these values but im not sure how I could use that since vector only permits one type of data type. Instead, my data has mixture of string, float and ints data.

Another alternative im thinking would be using istringstream obj(line)

and then declare each element variable's data type before
obj>>a>>b>>c>>d>>e

But Im not too sure it is working or correct concept. Please help.

Thanks.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:49 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0