Read error because of tabs

Read error because of tabs

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

4 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

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.

Thanks. I'll give that a try.

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

Steve

Accedere per lasciare un commento.