1. open file?
- Posted by Bernie Ryan <bwryan at PCOM.NET> Feb 04, 2000
- 322 views
When I use Rob's built-in file open to open a binary file. When I write a block of data to the file I get a message Critical Error: Abort, Retry, Ignore, Fail? ( in WIN95 dos ) When I open a binary for r/w using Jacques DosOpen in doswrap.e which uses #3D02 or #716C functions there is no error ? What file open function is Eu using and what mode numbers do the mode sequence really represent ??? Bernie
2. Re: open file?
- Posted by Bernie Ryan <bwryan at PCOM.NET> Feb 04, 2000
- 323 views
This is the problem with file open When I use the builtin open I get a file handle of 3 When I use Jacques DosOpen in doswrap.e I get a file handle of 5 If I open 2 dummey files before opening my binary file to force it to be file handle 5 then I can write to it without the error message. Bernie
3. Re: open file?
- Posted by "Lucius L. Hilley III" <lhilley at CDC.NET> Feb 04, 2000
- 327 views
You didn't specify how you are opening the file but I assume the following. integer handle handle = open("filename.ext", "rb") or "wb" but you should be using "ub" for random data files. PS: Just a hunch. (Really, more info. is needed to combat your problem) Lucius L. Hilley III lhilley at cdc.net +----------+--------------+--------------+ | Hollow | ICQ: 9638898 | AIM: LLHIII | | Horse +--------------+--------------+ | Software | http://www.cdc.net/~lhilley | +----------+-----------------------------+ > ---------------------- Information from the mail header ----------------------- > Sender: Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU> > Poster: Bernie Ryan <bwryan at PCOM.NET> > Subject: open file? > -------------------------------------------------------------------------- ----- > > When I use Rob's built-in file open to open a binary file. > > When I write a block of data to the file I get a message > > Critical Error: Abort, Retry, Ignore, Fail? ( in WIN95 dos ) > > When I open a binary for r/w using Jacques DosOpen in doswrap.e > > which uses #3D02 or #716C functions there is no error ? > > What file open function is Eu using and what mode numbers do the mode > > sequence really represent ??? > > > Bernie >
4. Re: open file?
- Posted by Robert Craig <rds at ATTCANADA.NET> Feb 04, 2000
- 311 views
Bernie Ryan writes: > Critical Error: Abort, Retry, Ignore, Fail? That's what happens when you write to a file that's already open for some other purpose. > When I use the builtin open I get a file handle of 3 > When I use Jacques DosOpen in doswrap.e I get a file handle of 5 The file handle number returned by DosOpen is not meant to be the same as the file handle number returned by Euphoria's open(). If there's some relationship, it's just a coincidence, and should not be relied on. Why are you trying to use DosOpen? In his comments Jacques assumes that loading a file into memory with normal Euphoria operations is slow. This is a myth. Do some measurements before you decide that you need DosOpen. You'll probably only save a few milliseconds, and your code won't be portable to Windows or Linux. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
5. Re: open file?
- Posted by Bernie Ryan <bwryan at PCOM.NET> Feb 04, 2000
- 331 views
On Fri, 4 Feb 2000 14:55:32 -0500, Robert Craig <rds at ATTCANADA.NET> wrote: >The file handle number returned by DosOpen is not meant to be >the same as the file handle number returned by Euphoria's open(). >If there's some relationship, it's just a coincidence, and should not >be relied on. > >Why are you trying to use DosOpen? >In his comments Jacques assumes that loading a file into >memory with normal Euphoria operations is slow. >This is a myth. Do some measurements before you >decide that you need DosOpen. You'll probably >only save a few milliseconds, and your code won't >be portable to Windows or Linux. > >Regards, > Rob Craig > Rapid Deployment Software > http://www.RapidEuphoria.com Rob: Then How do I write binary block structures to disks; a byte at a time ?? If a file handle is not standard then how will Euphoria ever be able to use files when another application has them open under conflicting handles. That means that a user also can only do things with files that use built-in features. ( which aren't always there ) Thanks Bernie
6. Re: open file?
- Posted by Robert Craig <rds at ATTCANADA.NET> Feb 04, 2000
- 320 views
Bernie Ryan writes: > Then How do I write binary block structures to disks; > a byte at a time ?? Using puts() you can write one byte, or a sequence of bytes at one time. The data is buffered into an 8K chunk in memory before the operating system is asked to write it to disk. You can write a pretty large file in less than a second. > If a file handle is not standard then how will Euphoria > ever be able to use files when another application has > them open under conflicting handles. That means > that a user also can only do things with files that use > built-in features. ( which aren't always there ) If the built-in file functions aren't good enough, you will have to use DOS interrupts or WIN32 or Linux API routines to open and manipulate the file. So far I've seen very few cases where this was useful, and none where it was necessary. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
7. Re: open file?
- Posted by Bernie Ryan <bwryan at PCOM.NET> Feb 04, 2000
- 315 views
On Fri, 4 Feb 2000 17:04:01 -0500, Robert Craig <rds at ATTCANADA.NET> wrote: >Using puts() you can write one byte, or a sequence of bytes at >one time. The data is buffered into an 8K chunk in memory before >the operating system is asked to write it to disk. You can write >a pretty large file in less than a second. Rob Puts is for writing sequences. I have a binary block of memory that I want to write to disk. Do I have to convert this block to a sequence to write it to disk ?? What is the point of having binary files in Euphoria if I have to convert everything to a sequence to write it to disk ?? Maybe I'am missing something ?? Bernie
8. Re: open file?
- Posted by Robert Craig <rds at ATTCANADA.NET> Feb 04, 2000
- 311 views
- Last edited Feb 05, 2000
Bernie Ryan writes: > Puts is for writing sequences. I have a binary block of memory > that I want to write to disk. Do I have to convert this block to a > sequence to write it to disk ?? What is the point of having > binary files in Euphoria if I have to convert everything to a > sequence to write it to disk ?? Maybe I'am missing something ?? puts(fn, peek({start, nbytes})) If it takes more than a fraction of a second, let us know. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
9. Re: open file?
- Posted by Bernie Ryan <bwryan at PCOM.NET> Feb 04, 2000
- 316 views
- Last edited Feb 05, 2000
Thank You That is ok Bernie