1. Re: open file? ROB help

On Fri, 04 Feb 2000, you wrote:

> Irv:
>
>      Are you using the latest version of Euphoria ???
Yes.
>      Are you writing binary structures to disk ??
Yes.
>      Euphoria doesn't support block writes and reads in binary mode.

Then what does get_bytes(fn,100) do?

>      doswrap.e works with my code if I open the file with dowwrap.e
>      Try opening a file with DosOpen function and see what handle is
>      returned. Then do the same with Euphoria open function and see if
>      the same handle is returned ??

I think you need a refresher on handles.
For every programming language that I have used on PC's,
0 = std_in (keyboard)
1 = std_out (screen)
2 = std_err (screen, also)
3 = first file opened by this process
4 = second file opened. by this process
etc.

Try this for yourself:
--prog1.ex
atom fn
fn = open("FILE1.DAT","rb")
? fn

--prog2,ex
atom fn
fn = open("FILE2.DAT","rb")
? fn

Run both at the same time.
Both will print 3, because FILE1 is the first file opened by program 1, and
FILE2 is the first file opened by program 2.

Now, change prog2 to open 4 other files _before_ it opens file2.
Program 1 will still print 3, but program 2 will print 7 as the file handle for
FILE2.DAT - FILE2 has changed handles.

Next, change prog2 to open the same file as prog1 opens.
Guess what, prog1 still prints a file handle for FILE1 = 3, and
prog2 still prints a file handle of 7 for FILE1.- Now FILE1 has two handles,
3 and 7.

Put another way, a handle is an _internal_ reference within the program which
references a file. The OS clearly knows nothing about this handle, because two
different  files surely couldn't _both_ be file 3, could they?
If you think this is a Euphoria problem, you can do exactly the same test in
Pascal or C, with the same results.

Irv

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu