Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Access to file in VB6

This topic is 5577 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there I made a little program to test an encryption app that i made with VB6 I encrypted all 256 ascii caracters using a key, then write the result in a file. I checked the lenght of the string that i write in the files, and it is indeed 256, so it''s allright. Then i immediatly read from the same file, but i only read 218 caracters! So, i write 256 car, but read 218 car, how come? here is a sample of my program:
    Dim i As Integer
    For i = 1 To 255
        ChaineAEncrypter = ChaineAEncrypter + Chr(i)
    MsgBox Len(ChaineAEncrypter) ''Results: 255
    ChaineEncryptee = Encrypter(ChaineAEncrypter)

    Open App.Path & "\TextFile.txt" For Output As #1
    Print #1, ChaineEncryptee & Chr(13)
    Close #1
    MsgBox Len(ChaineEncryptee) ''Results: 255

    Open App.Path & "\TextFile.txt" For Input As #1
    Input #1, ChaineDecryptee
    Close #1

    MsgBox Len(ChaineDecryptee) ''Results: 218
    ChaineDecryptee = Decrypter(ChaineDecryptee)
It seems it has problem with some of the ascii caracters, as from 1 to 128, there''s no problem but after that, it gets weirder I tried using binary file access, but, to tell the truth, i coucn''t find any info on how it works, so i couldn''t make it well any help is wellcome -ErayMan

Share this post

Link to post
Share on other sites
I suspect you''re writing a EOF (0) somewhere in the file. Well, about the 219th character to be percise.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!