- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to read a character strings from a data file and I get an error when there is a tab embedded.
The debugger shows a solid upright rectangular bar as the tab if that makes sense.
Are tabs not allowed in the file?
What could be a solution?
Thanks
The debugger shows a solid upright rectangular bar as the tab if that makes sense.
Are tabs not allowed in the file?
What could be a solution?
Thanks
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tabs are allowed, but when read into a character-string the string will contain tab-characters, which is what you seem to be finding.
You first need to decide what rule you want to apply for tabs ... sime fixed spacing of supposed tab locations perhaps, or simple replacement by a fixed number of blanks. Then find out what the tab-character is ... print out the value of IACHAR() for character(s) in your string.
Use this result to construct a test-character using ACHAR(). Then use this to parse your input string to find and expand the tab-characters in the way you want them expanded.
You first need to decide what rule you want to apply for tabs ... sime fixed spacing of supposed tab locations perhaps, or simple replacement by a fixed number of blanks. Then find out what the tab-character is ... print out the value of IACHAR() for character(s) in your string.
Use this result to construct a test-character using ACHAR(). Then use this to parse your input string to find and expand the tab-characters in the way you want them expanded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I'll give that a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tabs are not allowed in numeric input according to the standard, but many implementations treat a tab as a blank as an extension. You don't say what kind of READ you're doing - formatted, unformatted, list-directed, etc., nor what the item datatype is or format code (if any).
As noted above, tabs may cause the visual appearance of the data to be different than what the program sees when the file is read. In general, tabs in input are not a good idea, especially because of the column confusion.
Steve
As noted above, tabs may cause the visual appearance of the data to be different than what the program sees when the file is read. In general, tabs in input are not a good idea, especially because of the column confusion.
Steve

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