0

001 00002 0000003 00004 000005 6 000007 008009
------------------------------------------------------------------------------------------------------
GBL UTG.L 0692861 DCGB 000000 0 205750 826UTG
GBL UU.L 0646233 DCGB 000000 0 722501 -371UU.

I have the above data line by line each and coloumn has fixed width then in those i want to assign 9 coloumns to variables reading each line at a time.
Can you pleae help me how the indexing of this is possible in C++.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by ArkM
0

001 00002 0000003 00004 000005 6 000007 008009
------------------------------------------------------------------------------------------------------
GBL UTG.L 0692861 DCGB 000000 0 205750 826UTG
GBL UU.L 0646233 DCGB 000000 0 722501 -371UU.

I have the above data line by line each and coloumn has fixed width then in those i want to assign 9 coloumns to variables reading each line at a time.
Can you pleae help me how the indexing of this is possible in C++.

Use std::getline(std::iostream&,std::string) function to get data line by line and substr(initial_pos,field_width) std::string member function to extract data fields. Don't forget: starting pos is eq to 0...

I see only 8 columns in your example...

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.