Results 1 to 4 of 4

Thread: DAT FILE

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    16

    Question



    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

  2. #2
    Guest
    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

  3. #3
    Guest
    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
    This lock is only temporary as long as the file is opened. So by using the close statement the file is unlocked again...not?

  4. #4
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    If you print your files using the

    Code:
    open "text.dat" for output as #1
    print #1, "your text"
    close #1
    then your file will be seen using notepad. Using the lock function will only work while your application still is active and running.

    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.:

    Code:
    dim myplace as byte
    dim myvalue as integer
    open "text.dat" for binary output as #1
    input #1, myplace, myvalue
    close #1
    Of course before using this function you need to convert values and find a way to convert them to bytes.

    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]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width