Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Read multiple integers from a line
Topic Summary:
Created On: 21-Feb-2006 20:16
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 21-Feb-2006 20:16
User is offline View Users Profile Print this message


Al Lione

Posts: 59
Joined: 13-Jul-2004

I have a text file that looks like this:
235    2004
104    221
990   488

Basically it's any number of lines, with 2 integers on each line.
I want to create parallel arrays, one for each column.
I tried something like this in a loop
   input >> array1
   input >> array2

but it's reading down, i.e. 234, then 104, etc... How can I read across?

I am using DOORS 6.0 SR1
Report this to a Moderator Report this to a Moderator
 21-Feb-2006 23:10
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I think you need something like attached.

You could also read the file to count the lines, declare the arrays, then reread the file storing them into arrays.

- Louie
Report this to a Moderator Report this to a Moderator
 22-Feb-2006 12:52
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

You need to parse the line.

I won't repeat the code here since there are many examples of parsing a line within this forum and there are examples in the help file under Regular Expressions.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.