Please help find bug in my c++ program!
Hi,
I have made a small program that makes life a bit easier for people who run game servers and lan partys in linux. The problem is i am having problem working out what loop in my program is wrong, and i dont think it is reading games.db from the correct part. The program should read the games.db from the begging where the path is and then enter that directory and execute the start script. The games.db looks like this :- path;./startscript:gamename e.g /home/twirl/bf1942;./start.sh:Bf1942 The problem is i cannot see what loop in my program aint working correctly from case 3, as it should cd into the directory and execute the script and should print out errors if something aint right but it aint doing either. Please have a look at my code below and help a newbie to c++ out. All your help is very much appreciated! All code below compiles without errors Code:
#include <iostream> |
I'm not a very good programmer but:
You open games.db files multiple times but it is never closed so it stays at EOF. Therefore the second and third while loops are never executed. You can use the infile.seekg command to reset the file back to the beginning each time but I would probably read in the file in to an array. The game selection would be the address of the array instead of having to use a loop. Split the strings the first time into different arrays or use a structure. I see you are making some progress. |
Hi,
Thankyou for your reply, i tried re-writing the strings into variables instead to try and make life easier but for some reason its just going in a loop and i have to exit out of my terminal :o I do hope to get this last part working, as i would like to put it on sourceforge with document under the free license. Thankyou |
All times are GMT -5. The time now is 10:03 AM. |