Problem with Outputting to file - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html) +--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html) +--- Thread: Problem with Outputting to file (/thread-9429.html) Pages:
1
2
|
Problem with Outputting to file - Torahteen - 06-18-2006 For some reason, my program prints just one line, then quits. I'm thinking it may be because my encryption program is sticking an EOF character in on accident, but not sure... Code: Dim plaintxt As String Any ideas how to fix it? Problem with Outputting to file - WaffleMan - 06-19-2006 I wrote a similar cypher program once, except there's no password feature and it could load different cyphers from files. Anyway, one thing I noticed was the Close statements had numbers instead of the FREEFILE variables you declared. Other than that, I'm afraid I don't have the advanced programming skills to help you further. But at least I tried. Problem with Outputting to file - Torahteen - 06-20-2006 Thanks... I'm stilling having a problem guys... Any ideas at all? Problem with Outputting to file - axipher - 06-20-2006 Hey, I tried your code and me encrypted file was 3 times the size and my ciphered file was tottally messed up, the first line was repeated along with some wierd characters. Problem with Outputting to file - yetifoot - 06-20-2006 OK, it took me some time, but i think i got it. I don't think Line Input will work with the ciphered data, because its not normal text. I would suggest a method like this I haven't done any error checking in the code, but you can use the same function for crypt/decrypt. The key is a value 0-255 (although some values may be pointless IE 32 just flips the case of alpha text) Hope this gives you some ideas, you could add your random stuff or use a string as the key. It also will work on any file, not just text. Code: Option Explicit Problem with Outputting to file - Torahteen - 06-20-2006 Thank you yetifoot. Now it works... on my computer. My only problem is that I'm not sure that the random number generator is the same on each computer. Would someone mind testing it for me? Here is the code: Code: Declare Sub XORCrypt_Simple(inFile As String, outFile As String) Here is the encrypted message: Code: ÃÃÂ:â¢Ålº¿`Js˱ââ¢ÃÂ¥utfùýŽè9;rhzÃPÃÿŠ¸¼1â®-r±L&ÃÂ>²ùÃAâ¹Â¤xÂ®Ë Â³Â¸Ã¥PgÃ!iòKÃâ £¹Zâx?Wjëi¦Z£;^U252Jh!\âê¼yfõ=°®¿~¬1â& ¦ðT©¬Ãê©ò¾"Këà The password is 123. Let me know if it works. Problem with Outputting to file - Anonymous - 06-20-2006 I can tell you without even running it that the same seed value will work on any computer. Problem with Outputting to file - yetifoot - 06-21-2006 To be honest, it's probably pointless for me to try that example, as the forum probably lost some of the non-printable characters. Are you sure Chaos, don't Linux use the Berkley rand(), whereas windows use MSVCRT rand() ? I would probably hunt for a very simple random generator to use in the program, just to be sure. Problem with Outputting to file - DrV - 06-21-2006 Yeah, FB's random number generator is dependant on the libc rand(), which isn't guaranteed to be the same across platforms. Problem with Outputting to file - Torahteen - 06-21-2006 Hmm... well if you guys know of a random number generator library for FB, let me know. |