Solved

FILE* and streams

Posted on 2004-08-30
5
259 Views
Last Modified: 2010-04-01
Hello all,
   I'm making use of a static library that makes use of stdout and stderr as input to different functions that require a FILE* as a parameter.  I would like to make use of these functions, but do not want to create a temporary, ( or permanent for that matter ), file on the drive to make use of the functions.  What can I do to pass a stream into this function so that I can read the output from the function?

Thanks much.
0
Comment
Question by:edc
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:grg99
ID: 11936100
You could use a pipe.  Depending on the OS, it could be as simple as opening a file named "\\.\\pipe\\MyPipe".

0
 
LVL 1

Author Comment

by:edc
ID: 11936143
Hi grg99.  The OS is windows, (most likely 2K, XP and 2003, but could also be 9x).  Would the pipe work on the Windows OSs?

Thanks much.
0
 
LVL 1

Author Comment

by:edc
ID: 11936149
Also, if so, where can I find documentation on how to use it?

Thanks again.
0
 
LVL 16

Expert Comment

by:nonubik
ID: 11940884
Of course you can use pipes on Windows. Take a look here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/pipes.asp
0
 
LVL 22

Accepted Solution

by:
grg99 earned 125 total points
ID: 11941289
Note that pipes are kinda shaky-- the semantics of multiple pipe readers are very fuzzy.  Also Windows 95/98 are only half-assed-- they can be pipe clients but not servers.  Yet another intentional cripling, thanks MSoft.

I'd try using a temporary file, much easier and works on all OS's.

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question