| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Getting an .out file after running a program
I got one block of code that's filled with several nested if statements. I have five variables that are declared at the beginning of the main void{but still inside the main code blocks} Now the problem I am having is, well I dont think, with my actual code. I run the program and after it closes it adds an .out file to the folder or to were ever the .exe is. Could anyone help me with this problem please.
|
|
#2
|
||||
|
||||
|
If it occures when and only when you run the program, it has to be your code.
See if you have any FILE pointer variables declared in main(), if so, then it's likely that there may be a remnent of code left over from something that's causing that. Even if there isn't there it's possible there's a left over line from something that opens a file, but never gets the ptr assigned to a variable. Comb through every line of the program looking for a line that would open/create a file, such as fopen("blah.out","w"), fp.open("blah.out"), or the such....
__________________
Officially a member of the Itsacon fan club. Beer blasts are every friday at Viper_SB's house. I bring the chips. ![]() |
|
#3
|
||||
|
||||
|
I don't have any variables that point to files such as any .txt .doc and so on. I do have variables that might leave code un-passed. But Ill check it out just to make sure. Appreciate it..
|
|
#4
|
||||
|
||||
|
Quote:
|
|
#5
|
||||
|
||||
|
Here is the code, I hope I commented enough, but I don't think this will be that difficult for you to understand. Very simple in design. There are four different user's that will go through a list of questions or just comments. answer is to pick which user is doing the program, dad1 is for pops first question, kim is for kims first question, and solo is for the final question that asks to quit or return to user select menu. and that's pretty much it in a nutshell. The code works fine, its just that pesky .out file that keeps popping up, and yes B-con it only happens when I run it and only when. Sorry I forgot to answer that part yesterday =).
Code:
#include <iostream>
using namespace std;
int main(void)
{
int answer;
int dad1;
int kim;
int solo;
cout<<" \n"
<<" \n";
system ("PAUSE");
cout<<"\n"
<<" \n";
system ("PAUSE");
top://the goto is placed here. to select another person
do
{
cout<<"1] Pops\n"
<<"2] Alyssa\n"
<<"3] Kim\n"
<<"4] Solomon\n";
cin>>answer;
}
while (answer < 1||answer > 4);//loop condition
if (answer == 1)// first choice pops
{
cout<<" \n"//in this code I erased all the text comments.
<<" \n";//that way it will be less time consuming to look
do// through and debug..//Everything else is exactly the same.
{
cout<<"1] Show me\n"
<<"2] Na Ill look myself\n";
cin>>dad1;
}
while (dad1 < 1||dad1 > 2);
if (dad1 == 1)//nested if, pops second question
{
cout<<" \n"
<<" \n";
system ("PAUSE");
}
if (dad1 == 2)//if chosen only pauses
{ //I did this only for functionality
//otherwise it makes the text hard to
//follow.
system ("PAUSE");
}
cout<<" \n"
<<" \n";
}
if (answer == 2)//choice alyssa
{
cout<<"\n"
<<" \n";
system ("PAUSE");//used only so the user doesn't
//get confused with all the text
cout<<" \n"
<<" \n";
}
if (answer == 3)//choice kim
{
cout<<" \n"
<<" \n";
system ("PAUSE");//used for same reason...
cout<<" \n";
do
{
cout<<"1] Sure, tell me\n"
<<"2] No thanks\n";
cin>>kim;
}
while (kim < 1||kim > 2);//loop condition
if (kim == 1)//kims second choice
{
cout<<" \n";
system ("PAUSE");//these six pauses are
//because there is about two pages worth
//of text and it breaks it up kinda like
//paragraphs...
cout<<" First\n"
<<" \n";
system ("PAUSE");
cout<<" \n";
system ("PAUSE");
cout<<" \n";
system ("PAUSE");
cout<<" \n";
system ("PAUSE");
cout<<"\n";
system ("PAUSE");
}
if (kim == 2)//used for functionality
{
system ("PAUSE");
}
}
if (answer == 4)// choice for solo
{
cout<<" \n";
system ("PAUSE");
}
cout<<"\n";
do//loops quit or go back
{
cout<<"1] Quit\n"
<<"2] Go Back\n";
cin>>solo;//I used his name for the following question..
}
while (solo < 1||solo > 2);//loop condition
if (solo == 1)
{
cout<<" \n";//ending statement
system ("PAUSE");//used to pause to be able to
//read the final statements.
return EXIT_SUCCESS;
}
if (solo == 2)
{
goto top;//if chosen takes you back to chose another person
}
system ("PAUSE");
}
|
|
#6
|
||||
|
||||
|
hm, well, it's definately not your code.
You're using Borland, you say? Are there perhaps any project options that are turned on? Try taking just the source file and recompiling it by itself, it must be something the compiler is throwing in, or else it isn't related to your program.... |
|
#7
|
||||
|
||||
|
Well I use Dev-Cpp for my compiler, and yes I would have to agree. Im gonna try recomiling and see if that works thanks fer tha hep...
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Getting an .out file after running a program |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|