ok, I am creating Dat files in Windows notepad to store info.How can I make this file so the users can't open it andread the info? Can it be done? If so how would i go about doing this?
Thanks Jason
Printable View
ok, I am creating Dat files in Windows notepad to store info.How can I make this file so the users can't open it andread the info? Can it be done? If so how would i go about doing this?
Thanks Jason
To make it so that users can't read it, you'd have to encrypt your text. But here is how to make it so other programs cannot open your file or read it. In other words, lock it.
Code:Open "MyTXT.txt" For Output Lock Read Write As #1
Print #1, "MyText"
Close #1
This lock is only temporary as long as the file is opened. So by using the close statement the file is unlocked again...not?Quote:
Originally posted by Matthew Gates
...In other words, lock it....
Code:Open "MyTXT.txt" For Output Lock Read Write As #1
Print #1, "MyText"
Close #1
If you print your files using the
then your file will be seen using notepad. Using the lock function will only work while your application still is active and running.Code:open "text.dat" for output as #1
print #1, "your text"
close #1
Another idea would be to write your file in bytes, i.e. convert the data you need to bytes and specify where you write them to, i.e.:
Of course before using this function you need to convert values and find a way to convert them to bytes.Code:dim myplace as byte
dim myvalue as integer
open "text.dat" for binary output as #1
input #1, myplace, myvalue
close #1
Another solution: write a txt file using the first code. Fill your file with random numbers and characters, and then just point out the ones you need to compose your data (eg on position 13 you have the firsts letter, etc.). This is kind of encrypting.
Hope this helps,
W.
[Edited by wildcat_2000 on 11-17-2000 at 08:41 AM]