Redirection problem in C++

This is a discussion on Redirection problem in C++ within the C++ Programming forums, part of the General Programming Boards category; I'm using Quincy 2005 as my compiler in C++. I was asked to create a program that READS FROM a ...

  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
    21,409
    Run your program from a separate command prompt window.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    2,508
    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.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

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, 06:25 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21