Seek() behaves different on win32 and Amiga

Report any Hollywood bugs here
Post Reply
User avatar
lazi
Posts: 382
Joined: Thu Feb 24, 2011 11:08 pm

Seek() behaves different on win32 and Amiga

Post by lazi » Mon Mar 14, 2016 7:45 pm

If you Seek() over the length of a writeable file, Amiga stops at the file end, while win32 fills the gap with zeros.

Here is a test script:

Code: Select all

OpenFile(1,"test",#MODE_WRITE)
Seek(1,100)
WriteString(1,"DEADBEEF")
CloseFile(1)

DebugPrint(FileSize("test")) 


The results:
AmigaOS4: 8
win32: 108

User avatar
airsoftsoftwair
Posts: 3355
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Seek() behaves different on win32 and Amiga

Post by airsoftsoftwair » Mon Mar 14, 2016 9:29 pm

Good spot, will be fixed although it probably doesn't affect too many people ;)

User avatar
lazi
Posts: 382
Joined: Thu Feb 24, 2011 11:08 pm

Re: Seek() behaves different on win32 and Amiga

Post by lazi » Tue Mar 15, 2016 12:45 am

Yeah, not a problem, but good to know about :)

User avatar
airsoftsoftwair
Posts: 3355
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Seek() behaves different on win32 and Amiga

Post by airsoftsoftwair » Tue Sep 20, 2016 6:15 pm

Code: Select all

- Fix [Win32/Linux/MacOS/Android]: Using Seek() to position the cursor after the end of file when
  the file is in write mode actually filled the gap with zeros; this was inconsistent with the
  behaviour on AmigaOS; now it's impossible to position to cursor after the end of file with
  Seek()

Post Reply