![]() |
| | #1 |
| Registered User Join Date: Aug 2001
Posts: 428
| Error when I run an EXE file |
| dirkduck is offline | |
| | #2 |
| Registered User Join Date: Aug 2001
Posts: 223
| what is the error... Are you copying the file from the release folder and not the debug folder? Are there any file depencies such as ini files? When you run it from within the IDE are you using the debug run or the normal run. Are you doing any file io? If so make sure that you are reading from the correct directory. Have you tried running the exe from within the release folder by double clicking on it? Also you can trying walking the program with the debugger....even if it does not error out you can still find errors this way. hope that this helps....
__________________ zMan |
| zMan is offline | |
| | #3 |
| Registered User Join Date: Aug 2001
Posts: 428
| Thanks for the info. Ive tried debugging in, and it just crashes the debugger with 'exit code 0' I think it was. Anyway, ive narrowed it down to this line, which is in a function: Code: if((strcmpi(command,"end program"))==0) if(1) Then it runs just fine. Anyone know why? |
| dirkduck is offline | |
| | #4 |
| Sénior Member Join Date: Jan 2002
Posts: 982
| If I remember correctly there was a guy on the board who posted one line of code and asked people to guess what the error was a few days ago (about crashes in release build). Was it you? Post some code. |
| Sorensen is offline | |
| | #5 |
| Registered User Join Date: Aug 2001
Posts: 428
| Heres the whole function if it helps: Code: bool p_end_program(char *line,int type)
{
char command[256]={0};
int i=0;
for(i=0;i<11;i++) {
command[i]=line[i];
}
//compare strings to see if it was an end program
if((strcmpi(command,"end program"))==0)
// if(1)
{
cout << "NOTICE: found end program command"<<endl;
c_end_program(type); //call the other end program function
return true; //if it was end program, return true
}
return false; //otherwise return false
}
|
| dirkduck is offline | |
| | #6 |
| Sénior Member Join Date: Jan 2002
Posts: 982
| command is not a null terminated string. |
| Sorensen is offline | |
| | #7 |
| Registered User Join Date: Aug 2001
Posts: 428
| Ive tried it with {'\n'} (That would null terminate it, correct?) also, but it didn't change anything |
| dirkduck is offline | |
| | #8 | |
| Registered User Join Date: Aug 2001
Posts: 101
| Quote:
oh and i'd declare it like this char command[256]=""; anything contained in quotes is automatically ended with null. therefore, since nothing is in quote the char at command[0] equals '\0', the null character.
__________________ Sometimes, the farthest point from the center is the center itself. Your life is your canvas, it's only as beautiful as you paint it. Last edited by WayTooHigh; 03-25-2002 at 06:05 PM. | |
| WayTooHigh is offline | |
| | #9 |
| Registered User Join Date: Aug 2001
Posts: 428
| Thanks for the tip. I tried it, but it still didn't change anything. |
| dirkduck is offline | |
| | #10 |
| I'm Back Join Date: Dec 2001
Posts: 556
| for(i=0;i<11;i++) { command[i]=line[i]; } put command[11]='\0' and then try...
__________________ - |
| ihsir is offline | |
| | #11 |
| Registered User Join Date: Aug 2001
Posts: 428
| Still no luck |
| dirkduck is offline | |
| | #12 |
| Registered User Join Date: Aug 2001
Posts: 428
| Just incase it helps, ill try to give a better explanation of what im doing: I open up the workspace with my project in it, set it to compile release mode. Then go to build>execute program.exe. It compiles/links it, and It runs fine and dandy, all the way through. After that, I minimise VC++, go to the program directory>release, copy the 'program.exe' file to the base program directory. I run it from there, and when in the program it gets to the line mentioned above (the string comparison), bang, it throws up 2 illegal errors. There are about 5 more functions it calls before that which are identical to it, just very minor differences (like the length of the for...loop), which seem to run fine. Does that make more sence? Thanks. |
| dirkduck is offline | |
| | #13 |
| Registered User Join Date: Aug 2001
Posts: 101
| is there a reason you don't do this? Code: if((strcmpi(line,"end program"))==0)
__________________ Sometimes, the farthest point from the center is the center itself. Your life is your canvas, it's only as beautiful as you paint it. |
| WayTooHigh is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| opening empty file causes access violation | trevordunstan | C Programming | 10 | 10-21-2008 11:19 PM |
| Inventory records | jsbeckton | C Programming | 23 | 06-28-2007 04:14 AM |
| Basic text file encoder | Abda92 | C Programming | 15 | 05-22-2007 01:19 PM |
| System | drdroid | C++ Programming | 3 | 06-28-2002 10:12 PM |