Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / File handling problem

Author
Message
Mizipzor
20
Years of Service
User Offline
Joined: 24th May 2004
Location: Sweden
Posted: 8th Jun 2004 23:56
Im trying to learn how to manage .txt files. I decided to write a little encryption program.

Heres my code:



When i open the file encrypted.txt i see that its empty. Why is that? Its not that the string is empty because as you can see i print it on screen and i see the encrypted string there.

Thanks in advance
Mizipzor

Dreaming of creating a highly advanced AI mind
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 9th Jun 2004 00:07
remove the make file, you don`t need to make a file when you open to write, all you have done is made a file that is empty, the open to write should fail and give an error message (file exists at line xxx), make file is used to make blank files that you can use as flags to show the software the current status, (thats the only use I found for them), for example, to NOT show the lengthy intro animation the next time your code is run, just make a file called "played" when you play the intro, before you do play the intro though, check if the file "played" exists, if it does then don`t play the intro again, if it doesn`t then the user deleted it or this is the first time the code has been run, so play the intro, cheers.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster, ups.
Mizipzor
20
Years of Service
User Offline
Joined: 24th May 2004
Location: Sweden
Posted: 9th Jun 2004 00:12
That was just about the quickest answer i ever got in this forum. And it worked to!

Cheers mate, and thanks!
Mizipzor

Dreaming of creating a highly advanced AI mind

Login to post a reply

Server time is: 2024-11-26 20:26:18
Your offset time is: 2024-11-26 20:26:18