24 August 2017, 21:31 | #1 |
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 339
|
Append a file?
It was many years ago I was messing with dos.library so.. Is there a good way of appending a file (68k asm)?
Currently it looks like I have to use Seek() to detect end of file and then write(?) but I hope there's a better way...? Thanks in advance. |
24 August 2017, 22:07 | #2 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
|
There are only 3 modes for Open(): MODE_READ, MODE_WRITE and MODE_READWRITE.
AFAIK the only way to append using dos.library is to open the file using MODE_READ or MODE_READWRITE, seek to the end and Write(). I must admit I never did that. When I needed this, I always used a C program and the "a" mode |
24 August 2017, 22:38 | #3 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
You cannot write to a file opened with MODE_OLDFILE. (At least you should not expect to be able to.)
MODE_READWRITE is the only legal way to write to an existing file without erasing it. To write to the end of the file you Seek(fh,0,OFFSET_END) and then just Write(). |
24 August 2017, 23:07 | #4 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
|
in my old "dos.guide": if the mode is MODE_OLDFILE, the file is opened in reading and writing.
It also explains that the difference with MODE_READWRITE is that READWRITE creates the file if doesn't exist (OLDFILE doesn't) |
25 August 2017, 09:00 | #5 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
|
Quote:
Writing to such a file is perfectly possible but you do not know the file is writeable before you actually try to do it. |
|
25 August 2017, 21:39 | #6 | |
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 339
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
asm code file errors and external file locations | Brick Nash | support.WinUAE | 0 | 06 April 2015 17:14 |
File .NFO & file ID.diz stuff.... How To..!! | DC33 | support.Other | 4 | 11 March 2009 10:21 |
File not executable | ancalimon | support.WinUAE | 8 | 15 February 2008 17:18 |
Running non .adf file, .info file?? | ypestis | New to Emulation or Amiga scene | 5 | 29 March 2006 18:53 |
|
|