removing blanks from a file
- From: Luka Djigas <ldigas@@gmail.com>
- Date: Fri, 30 Jun 2006 01:39:13 +0200
Greetings
English is not my mother language, so I'd like to apologize in
advance, if this sounds a little funny to you.
Since fortran programmers are running thin in my part of the world,
and since looks like there's a good deal of them here, I was wondering
if you could help me with a little problem I'm having (searched
google, found some half solutions but nothing concrete)
I have a file, which is the output of one of my programs. It's a
script file, and therefore it's not supposed to have blanks in it.
The file looks something like this
1.0, 1.0, 1.0
1.0, 1.0, 1.0
....
and it would be good if it looked like this
1.0,1.0,1.0
1.0,1.0,1.0
....
I tried something like this
CHARACTER(1) :: CH
INTEGER(4) :: IOEND=0
OPEN(1,FILE='FILE.TXT')
DO WHILE (IOEND/=-1)
READ(1, "(A1)", IOSTAT=IOEND, ADVANCE="NO")CH
IF CH=CHAR(49)
CH=CHAR(50)
WRITE(1, "(A1)", ADVANCE="NO")CH
END DO
CLOSE(1)
END
If you try it you will see that it has some drawbacks.
Please, if anyone has some ideas how to solve this problem, I'd be
very grateful, if he/she would share them.
Luka Djigas
ldigas@@gmail.com (kill one monkey)
.
- Follow-Ups:
- Re: removing blanks from a file
- From: David Frank
- Re: removing blanks from a file
- From: Richard Maine
- Re: removing blanks from a file
- From: dpb
- Re: removing blanks from a file
- From: Bil Kleb
- Re: removing blanks from a file
- From: tholen
- Re: removing blanks from a file
- Prev by Date: Re: Efficient way to pass different shaped arrays?
- Next by Date: Re: removing blanks from a file
- Previous by thread: How to Find Memory Used (IVF 9.1, WinXP)
- Next by thread: Re: removing blanks from a file
- Index(es):