Subj : HW 100.2
To   : Prime
From : Amcleod
Date : Thu Dec 06 2001 08:04 am

RE: HW 100.2
BY: Prime to Amcleod on Tue Sep 19 2000 07:31 am

>  > Don't try doing arithmetic with file handles!  :)  The arithmetic will wo
>  > fine, but the files themselves are likely to go to hell very shortly
>  > thereafter!
>
> What, exactly, _WOULD_ happen if you _did_ do arithmetic with file handles?
>

Well, handles are just integers, and they can be just about anything.  for
instance they may represent integer indexes into a table of file-control-blocks
so if you added your third and fifth handles you would get the handle of some
file furthur up the table -- possibkly one never opened --  and the results of
accessing that file would be (most likely) a dismal failure with interesting
side-effects.  Possibly the the handle is the actuall _address_ of the FCB and
so monkeying with them could give a pointer into some random part of memory
which would again, give interesting and unpredictable side effects if you tried
to use it.

You can probably experiment safely with _writing_ the file handle to the
console.  Open three or four files and print the file handles as integers.  You
may get a series of integers like 3, 4, 5, 6 for the four filehandles.  SO you
add two to the first file handle and it suddenly becomes the third
filehandle...
\/s


---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net