- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
in a text file each line contains an arbitrary number of values. I would like to read this file line by line and determining the number ofvalues in every line.
Does anyone know a simple method for this problem.
Thanx in advance.
dnoack
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Look in the documentation regarding nonadvancing I/O (ADVANCE='NO')and use of EOR=nnn or IOSTAT=iStatus.
Or, depending on your data, you could preload your input arraywith a value that will never be in your input. After reading a record check for your preload value.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assuming your lines are of a reasonable length I'd read the line into a string long enough to hold your longest expected line
If you have no seperators the number of values is simply obtained from the length of the string trimmed to remove white space at the end divided by the size of your value.
If you have seperators - commas, spaces whatever count them, the number of values will be the same as your count if there is a seperator after the final value or 1 more if not
You can then use internal IO to convert obtain the values from the string

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page