Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Read error because of tabs

pecan204
Beginner
761 Views
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
0 Kudos
3 Replies
david_jones
Beginner
761 Views
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.
0 Kudos
pecan204
Beginner
761 Views
Thanks. I'll give that a try.
0 Kudos
Steven_L_Intel1
Employee
761 Views
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
0 Kudos
Reply