we ought to have a AI bot that plants thes posts at the bottom of the appropriate thread since they come around every few weeks, just make your own file extension up to idebtify the file to your program and so it knows that .sav is a savegame and .map is a levelmap etc, you can use bytes or strings or whatever you like, just read em back in the same order as what you wrote em, as for encryption, heres a simple example app that encrypts a bitmap into a .xxx file (an own named filetype), you can`t read the bitmap unless you have the key, for more security you could encrypt it several times with different keys, that way the complexity increases by the power of whatever number range you use for each pass....
Rem Project: encoder
Rem Created: 23/08/2004 20:34:53
Rem ***** Main Source File *****
seed=3267
randomize seed
print "setting random number generator to seed value"
a=file size ("image.bmp")
print "getting size of file"
open to read 1,"image.bmp"
print "opening image to read"
open to write 2,"encrypted.xxx"
print "opening file to save encryption too"
for i=1 to a
read byte 1,b
b=b+rnd(256)
if b>256
b=b-256
endif
write byte 2,b
next i
print "file encrypted"
close file 1
close file 2
print "file IO closed"
delete file "image.bmp"
print "file destroyed"
wait 2000
print "re-creating file from encoded file"
wait 1000
print "opening .xxx file"
open to read 1,"encrypted.xxx"
print "re-setting seed value to duplicate number sequence"
randomize seed
print "opening target file"
open to write 2,"image2.bmp"
c=file size ("encrypted.xxx")
if a=c then print "NO DETECTED FILE CORRUPTION, encoded is exactly the size of the original"
print "extracting file from xxx encryption archive"
for i=1 to c
read byte 1,d
d=d-rnd(256)
if d<0
d=d+256
endif
write byte 2,d
next i
print "closing file IO streams"
close file 1
close file 2
print "loading restored image"
wait 4000
load bitmap "image2.bmp"
do
loop
Mentor.
PC1: P4 3ghz, 1gig mem, 3x160gig hd`s, Radeon 9800pro w cooler (3rd gfx card), 6 way speakers.
PC2: AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
Mini ATX cases suck.