Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 what does a stand-alone .exe file do
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lufthansa747




PostPosted: Wed Nov 03, 2010 7:41 pm   Post subject: what does a stand-alone .exe file do

i have created a stand alone program file for my game but it still need to be in the same folder as the high score file i am using is there any way around that
Sponsor
Sponsor
Sponsor
sponsor
SNIPERDUDE




PostPosted: Wed Nov 03, 2010 7:52 pm   Post subject: RE:what does a stand-alone .exe file do

Nope. That's why you should keep your program in a folder with all your needed files, and when posting or uploading keep it in a ZIP or RAR compressed folder file.

Though if you are talking about keeping resources in a sub-folder that is very possible (ex: "resources/high scores.txt").
jcollins1991




PostPosted: Wed Nov 03, 2010 9:24 pm   Post subject: Re: what does a stand-alone .exe file do

Well you could get around it using absolute directories ("/path/to/folder/..." or "C:\path\to\folder\..." for Windows) in your program, but then if you switch systems you have to ensure that the files are in the same place in both computers. Sniperdudes suggestion of subfolders would probably be the best for any small coding projects.
SNIPERDUDE




PostPosted: Wed Nov 03, 2010 10:19 pm   Post subject: RE:what does a stand-alone .exe file do

Also when using absolute directories it can change system to system, even for different Windows users. For example, because I use a 64 bit version of Windows 7, if I install a program that is 32 bit (most are), it will go in a separate directory than 'Program Files' called 'Program Files (x86)'.
Either way, just addressing to immediate subdirectories is safer.
mirhagk




PostPosted: Fri Nov 05, 2010 2:07 pm   Post subject: RE:what does a stand-alone .exe file do

Hey just a theory, but what would happen if the .exe opened itself and wrote to the end of the file. Theoritically it shouldn't crash the program so long as the program does a proper exit at the end (which I hope it does lol). You could have all your high scores actually within the .exe file.

Dunno if there would be some odd problem that would come along with that, maybe I'll try it one day. Would be a pretty gool way to make sure people don't just open a .txt file and change the scores around.
SNIPERDUDE




PostPosted: Fri Nov 05, 2010 5:05 pm   Post subject: RE:what does a stand-alone .exe file do

One interesting thing I used to do is instead of writing information to a .txt extension, I wrote it to .exe extensions instead (you could even make one up if you desire). It read and wrote to and from it just fine, the only difference is you couldn't right click on the file and click "open with" to view the info (note: you wouldn't be able to "run" the executable, it would just give an error).

No really practical or fool-proof, but I found it interesting at least.
mirhagk




PostPosted: Sat Nov 06, 2010 12:20 am   Post subject: RE:what does a stand-alone .exe file do

yeah im thinking if you just attach that to the end of the .exe it would be completely hidden from the user, they wouldn't even know about it
TheGuardian001




PostPosted: Sat Nov 06, 2010 12:22 am   Post subject: Re: RE:what does a stand-alone .exe file do

mirhagk @ Sat Nov 06, 2010 12:20 am wrote:
yeah im thinking if you just attach that to the end of the .exe it would be completely hidden from the user, they wouldn't even know about it

I'm thinking that would probably break the exe...
Sponsor
Sponsor
Sponsor
sponsor
mirhagk




PostPosted: Sat Nov 06, 2010 12:44 am   Post subject: RE:what does a stand-alone .exe file do

but if it's at the end, why would it? the exit code would happen before it, it would basically be like code placed after the return statement
TheGuardian001




PostPosted: Sat Nov 06, 2010 6:22 pm   Post subject: Re: RE:what does a stand-alone .exe file do

mirhagk @ Sat Nov 06, 2010 12:44 am wrote:
but if it's at the end, why would it? the exit code would happen before it, it would basically be like code placed after the return statement

It seems to depend on the program you're editing. I've been able to edit some without them breaking, but others have said they're corrupt when I try to run them.

Oh, also, when you're running a program, the file is read only.
mirhagk




PostPosted: Sat Nov 06, 2010 9:54 pm   Post subject: RE:what does a stand-alone .exe file do

ah, but you could do some intense hacks. heres what im thinking. make a seperate program that writes the scores to the .exe, store it at the end of the main program's exe, then copy that from the main progam with a txt file of the high scores, then when the program exits it calls that other program which writes the high scores and deletes the txt file.
Ultrahex




PostPosted: Sat Nov 06, 2010 10:02 pm   Post subject: Re: what does a stand-alone .exe file do

Many of the suggestions are complete overkill, it would be much easier to write an encryption scheme; or use an existing one with a hidden hash offset.
mirhagk




PostPosted: Sat Nov 06, 2010 11:31 pm   Post subject: RE:what does a stand-alone .exe file do

oh i know its overkill and a half. obviously the easiest would be to just encrypt it and/or set traps for if someone changes it, it detects it. ie having scores in 3 parts, and rules as to how they are constructed, or simply a check code like credit cards do.

actually the last one would be best. just have it add/subtract the digits a ceratin way and then the answer would be the check code, so a user wouldnt know how to construct the check code, so they'd get it wrong and the program would berate them for it.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to:   


Style:  
Search: