Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHILE WRITING TO A FILE

Status
Not open for further replies.

harshcseiitb

Programmer
Sep 30, 2002
7
IN
when i write a character string to a file it leaves 1st
bit of file blank.

help me out
thanx in advance
 
It is possible you are using a version of Fortran with carriage control in the formats. Some have it, some don't. The interpretation of the first character varies. Normally 1 means form feed which may be why you are seeing blanks. Try 1X, before your print string format.
 
If the file can be opened as BINARY, no control characters will be written.
 
More than likely you are using list directed output:
write (*,*) 'hello'
or
print *, 'hello'

List directed output on some compilers prints a blank character first. To print directly (without blank charater)use explicit formatting :
write (*,'(A)') 'hello'
or
print '(A)', 'hello'

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top