delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/13/14:15:20

From: "Chris A. Triebel" <cat AT sun4 DOT iol DOT unh DOT edu>
Newsgroups: comp.programming,comp.os.msdos.djgpp
Subject: standard input and files
Date: Sun, 13 Oct 1996 13:00:03 -0400
Organization: University of New Hampshire - Durham, NH
Lines: 15
Message-ID: <Pine.SUN.3.91.961013125209.5008A-100000@sun4.iol.unh.edu>
NNTP-Posting-Host: sun4.iol.unh.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Here's the scenario I need.

I want to create an executable that will compile under DOS ( djgpp ) and 
most UNIX systems.  I want a functionality like more that can take input 
from standard input or from a file.  Like the more command ( on unix ) or 
grep or something.  I also want to use ifstreams to do the input.  

Question:
	Can I assume that standard input is always file descriptor 0, or 
can I get it's file descriptor from the standard libraries of C/C++.  
Is it part of the C++ standards that fd0 is always going to standard 
input, redirected or not?

TIA
cat

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019