Thread: Redirection problem in C++

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    1

    Redirection problem in C++

    I'm using Quincy 2005 as my compiler in C++.

    I was asked to create a program that READS FROM a separate data.txt file. We are not allowed to use fscanf so i used the redirection method in Quincy (Tools->Options->Run->Use this: "input<data.txt") Now, the program is working but for some reason it automatically closes and is not asking whether to "press any key to continue", since the redirection emits all keyboard inputs and closes automatically. As I said before, the program works but it closes too fast that I can't even see what the output is (I know its working because I used the cmd prompt). Is there any way to prevent it from automatically closing so that I can see the output

    Thank you

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Run your program from a separate command prompt window.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by Renq View Post
    I'm using Quincy 2005 as my compiler in C++.
    Per Quincy: Simple free C/C++ programming IDE for Windows
    FYI: "Quincy 2005" is an IDE not a compiler; it uses a version the MinGW GCC as the Compiler.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 09-24-2011, 01:30 AM
  2. Dos Redirection
    By En-Motion in forum C Programming
    Replies: 3
    Last Post: 10-07-2008, 11:24 PM
  3. Problem with execl() and redirection.
    By arunj in forum C Programming
    Replies: 6
    Last Post: 03-20-2008, 08:59 PM
  4. Cout redirection problem
    By MrLucky in forum C++ Programming
    Replies: 6
    Last Post: 06-06-2007, 11:11 AM
  5. Help with redirection
    By Nornny in forum C++ Programming
    Replies: 1
    Last Post: 04-01-2004, 07:25 AM