SetEOF() ?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
RValois
User
User
Posts: 16
Joined: Fri Aug 15, 2003 6:31 am
Location: Brazil
Contact:

SetEOF() ?

Post by RValois »

It seems that this function is missing.
BTW Is the return value from OpenFile/OpenPack the File handle on Windows OS ?

Thank you,
RValois.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: SetEOF() ?

Post by PB »

RValois
User
User
Posts: 16
Joined: Fri Aug 15, 2003 6:31 am
Location: Brazil
Contact:

Post by RValois »

Thanks for answering but that is not what I am looking for.
SetEOF function is used to truncate/extend the file size.
http://msdn.microsoft.com/library/defau ... offile.asp

Regards,
RValois.
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Yes, it's missing. Ff you desperately need this right now you can always use something like this:

Code: Select all

SetEndOfFile_(UseFile(#YourFileNr))
RValois
User
User
Posts: 16
Joined: Fri Aug 15, 2003 6:31 am
Location: Brazil
Contact:

Post by RValois »

Based on your information, UseFile() returns the Windows file handle.
What about OpenFile/OpenPack ? Could you confirm/deny if these functions also do return the Windows file handle?

Thank you,
RValois.
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

OpenFile returns the handle, of that i'm sure. I can't say anything about OpenPack though, because i've never had the need to get a file handle for that sort of file.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Note:

If you use SetEndOfFile_(UseFile(#YourFileNr)) to extend your file, Windows
will fill the new file space with data from your memory! This might be
some random nonsense data, but it could also be passwords, or some
personal data, that has just been in memory at that time.

So make sure, you fill the area with data, if neccesarry, with a lot of 0's

Timo
quidquid Latine dictum sit altum videtur
Post Reply