- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I have a problem with a .f code.
I write a number of data in a file with
...
if (icomp.eq.0) then
open(11,file='ic_deltab',form='unformatted')
else if (icomp.eq.2) then
...
rewind 11
write(11) np1,np2,np3,dx,x1o+xoff,x2o+xoff,x3o+xoff,
& astart,omegam,omegav,h0
...
The number np1=np2=np3=128
But when I read the file ic_deltab and write the data with (.f90)
...
open(11,file='ic_deltab',form='unformatted')
rewind 11
read(11) np1,np2,np3,dx,x1o,x2o,x3o, &
& astart,omegam,omegav,h0
write(*,*) np1,np2,np3
...
I find 0 128 128, no 128 128 128
I did the following test. I wrote np2,np1,np3 and the result was the same: 0 128 128.
I write 128,np2,np3 and... the result was the same: 0 128 128.
If somebody can help me, thank you.
I write a number of data in a file with
...
if (icomp.eq.0) then
open(11,file='ic_deltab',form='unformatted')
else if (icomp.eq.2) then
...
rewind 11
write(11) np1,np2,np3,dx,x1o+xoff,x2o+xoff,x3o+xoff,
& astart,omegam,omegav,h0
...
The number np1=np2=np3=128
But when I read the file ic_deltab and write the data with (.f90)
...
open(11,file='ic_deltab',form='unformatted')
rewind 11
read(11) np1,np2,np3,dx,x1o,x2o,x3o, &
& astart,omegam,omegav,h0
write(*,*) np1,np2,np3
...
I find 0 128 128, no 128 128 128
I did the following test. I wrote np2,np1,np3 and the result was the same: 0 128 128.
I write 128,np2,np3 and... the result was the same: 0 128 128.
If somebody can help me, thank you.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For a sanity check, if you haven't done so, delete the file, so as to force its creation (in compatible format) on the first open.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
For a sanity check, if you haven't done so, delete the file, so as to force its creation (in compatible format) on the first open.
I did the following test:
...
rewind 11
write(11) 1,2,3,dx,x1o+xoff,x2o+xoff,x3o+xoff,
& astart,omegam,omegav,h0
...
When I read the first 3 data (1 2 3) I get 0 1 2. It seems for a unknown reason the file start with a 0 or without a number.
Some clue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please provide a short but complete example that demonstrates the problem.

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