C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 3rd, 2005, 01:00 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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.

Reply With Quote
  #2  
Old August 3rd, 2005, 02:26 PM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 43 sec
Reputation Power: 4
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.



Reply With Quote
  #3  
Old August 4th, 2005, 05:37 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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..

Reply With Quote
  #4  
Old August 5th, 2005, 02:03 AM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 43 sec
Reputation Power: 4
Quote:
Originally Posted by Geo.Garnett
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..
If you still can't find the problem, upload the source code file and I'll take a look at it....

Reply With Quote
  #5  
Old August 5th, 2005, 10:37 AM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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");
}

Reply With Quote
  #6  
Old August 5th, 2005, 02:49 PM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 43 sec
Reputation Power: 4
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....

Reply With Quote
  #7  
Old August 5th, 2005, 04:41 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Getting an .out file after running a program


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT