random access files

Just starting out? Need help? Post your questions and find answers here.
scurrier
Enthusiast
Enthusiast
Posts: 169
Joined: Sat May 03, 2003 4:10 am

random access files

Post by scurrier »

random access and binary files would be great
this way you can save infomation that people dont need to see or want them to play with

or can someone who is good a c++ write a library or dll would rather have the lib to do random access files and or binary files

i tried but i dont know alot about lcc and it's a real pain in vcc to get it to be a lib for pb and as a dll it does this name mangling thing so my function thats called saverandom() is turned into !@#$%saverandom$%%^() or somthing like that

try calling that from PB
stupid M$.....
thanks
Sean
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: random access files

Post by tinman »

scurrier wrote:random access and binary files would be great
What do you mean? Random access files are supported (use FileSeek()) and using ReadByte(), WriteByte() etc allows you to work with binary files.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
scurrier
Enthusiast
Enthusiast
Posts: 169
Joined: Sat May 03, 2003 4:10 am

Post by scurrier »

yes that works but your file is in plain text format no to secure
i think it should make a binary file that looks like (*&@#$H& kmh
when you look at it in a text editor and what you saved
Froggerprogger
Enthusiast
Enthusiast
Posts: 423
Joined: Fri Apr 25, 2003 5:22 pm
Contact:

Post by Froggerprogger »

If you want to write something like *&@#$H& kmh in a file, you can do this, either as a string, or use WriteData. There's no problem about it.
Read/Write Byte/Word/Long/Float do read/write a simple number. Read/Write String do read/write a string - so it only contains 'ASCII-Chars (bytes)' without the 0. With Read/Write Data you can read/write whatever you want, the data of an image or anything else.

It's up to the programmer to save a string such as "Hello World" as "("§$%&/" You have to crypt it yourself.
%1>>1+1*1/1-1!1|1&1<<$1=1
talun
User
User
Posts: 28
Joined: Mon May 05, 2003 3:53 pm
Location: Italy

Post by talun »

Hi Scurrier,
maybe this link can be useful for you:
viewtopic.php?t=2396&highlight=writedata

bye

sergio
scurrier
Enthusiast
Enthusiast
Posts: 169
Joined: Sat May 03, 2003 4:10 am

Post by scurrier »

thanks for the example but after i run and check the file it's still in plain text readble from notpad i am looking for something that saves it encrypted like the days of old basic that would save a binary or random access file that can not be undersood in a text editor i will see if i can find an example for you to see check back later
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1286
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

You could always try the DLL I made for my own use, which is available on the Resources Site in the DLL archive.
Image Image
Post Reply