Thread: General a.out redirection question under Linux

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    14

    General a.out redirection question under Linux

    Hi@all

    I wrote a program that reads data from a file under Linux. I am suppose to use a.out redirection to read the file. After read the file, I want to stop a.out redirection and enter some input from keyboard. Is this possible?

    Please help me..

    Thanks

  2. #2
    ^ Read Backwards^
    Join Date
    Sep 2005
    Location
    Earth
    Posts
    282
    Yes.
    When you are done with reading the data from the file just go back to the screen,
    I.E.

    Code:
    {read file code}
    
    cout << “Sup’ user, enter some data”;
    int data;
    
    cin >> data;

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    That won't work because the file data is being read through cin using redirection.

    I don't think it's possible.

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    14
    Quote Originally Posted by Enahs
    Yes.
    When you are done with reading the data from the file just go back to the screen,
    I.E.

    Code:
    {read file code}
    
    cout << “Sup’ user, enter some data”;
    int data;
    
    cin >> data;
    Hi Enahs

    As Daved said, cin doesn't work because of redirection. When program executes, it skips the line that includes cin command.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. General forum question - if in wrong forum...
    By ulillillia in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 05:00 AM
  2. General linking question
    By BrandonW in forum C Programming
    Replies: 5
    Last Post: 05-02-2007, 12:24 PM
  3. Linux (not programming) E-mail server question.
    By Kennedy in forum Tech Board
    Replies: 4
    Last Post: 11-09-2006, 02:08 AM
  4. General GUI question in C
    By Music_Man in forum Game Programming
    Replies: 3
    Last Post: 11-16-2001, 11:45 AM
  5. Question about LINUX
    By River21 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-17-2001, 06:39 PM