473,473 Members | 1,604 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

streams again

Hello.

I have three question about ofstream and ifstream.

1. I have a function that writes some text-output into ofstream. The
reference to that ofstream it got as a parameter. I have no access to source
code of it. I need redirect the output to somehing, for example to a CEdit
control.

2. I have a function that writes some text into cerr (stderr). No
parameters. No access to source code. I need redirect the output to
somehing, for example to a CEdit control.

3. I have a function that reads text from cin (stdin). No parameters. No
access to source code. I need to send into this function text from my char[]
or from CEdit control.

I know a bit about redirection of stdin and stdout for a child process using
pipes and streambuf overlapping. But there is only one process in my
application.
I can create a thread, but I don't want it.

Best regards,
Shestero Michael
Jul 22 '05 #1
3 2898

"Michael Shestero" <sh******@cyber.miem.edu.ru> wrote in message
news:bp*************@ID-54498.news.uni-berlin.de...
Hello.

I have three question about ofstream and ifstream.

1. I have a function that writes some text-output into ofstream. The
reference to that ofstream it got as a parameter. I have no access to source code of it. I need redirect the output to somehing, for example to a CEdit
control.

2. I have a function that writes some text into cerr (stderr). No
parameters. No access to source code. I need redirect the output to
somehing, for example to a CEdit control.

3. I have a function that reads text from cin (stdin). No parameters. No
access to source code. I need to send into this function text from my char[] or from CEdit control.

I know a bit about redirection of stdin and stdout for a child process using pipes and streambuf overlapping. But there is only one process in my
application.
I can create a thread, but I don't want it.

Best regards,
Shestero Michael


You will have to ask this specific questions in a Microsoft VC newsgroup
because this newsgroup deals with standard C++ issues only.

[off-topic]
If I remember correctly there is a way of at least redirecting output from
cout to a window, as MS uses it for its Visual Studio. Try
ww.codeguru.com - I think I once saw a discussion about that there.

Chris
Jul 22 '05 #2
Dear Chris,

Well, forget about CEdit and Microsoft! Read char[] instead CEdit. My
question is about the streams redirection in standart C++, not about the
features of CEdit.
ofstream and ifstream is in Borland C++, GNU C++, MS VC++. The three
functions I have mentioned in my questions can be compiled in all above and
also in IAR eMbedded C++.
I guess this is quite standart C++ issue, isn't it?
To tell the compleate story the metter is that I try to leave this three
functions on standart C++ for source-level compatability, that's why I don't
want to change their code during integration into my MFC application.

Bye.

I have three question about ofstream and ifstream.

1. I have a function that writes some text-output into ofstream. The
reference to that ofstream it got as a parameter. I have no access to

source
code of it. I need redirect the output to somehing, for example to a CEdit control.

2. I have a function that writes some text into cerr (stderr). No
parameters. No access to source code. I need redirect the output to
somehing, for example to a CEdit control.

3. I have a function that reads text from cin (stdin). No parameters. No
access to source code. I need to send into this function text from my

char[]
or from CEdit control.

I know a bit about redirection of stdin and stdout for a child process

using
pipes and streambuf overlapping. But there is only one process in my
application.
I can create a thread, but I don't want it.

Best regards,
Shestero Michael


You will have to ask this specific questions in a Microsoft VC newsgroup
because this newsgroup deals with standard C++ issues only.

[off-topic]
If I remember correctly there is a way of at least redirecting output from
cout to a window, as MS uses it for its Visual Studio. Try
ww.codeguru.com - I think I once saw a discussion about that there.

Chris


Jul 22 '05 #3

"Michael Shestero" <sh******@cyber.miem.edu.ru> wrote in message
news:bp*************@ID-54498.news.uni-berlin.de...
Dear Chris,

Well, forget about CEdit and Microsoft! Read char[] instead CEdit. My
question is about the streams redirection in standart C++, not about the
features of CEdit.
ofstream and ifstream is in Borland C++, GNU C++, MS VC++. The three
functions I have mentioned in my questions can be compiled in all above and also in IAR eMbedded C++.
I guess this is quite standart C++ issue, isn't it?


You can, with standard C++, 'redirect' i/o to/from std::string
objects, using stringstreams. Character arrays can be inserted/
extracted to/from std::string objects.

Read about stringstreams.

-Mike
Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ronald Legere | last post by:
The new itertools stuff is pretty cool. One thing that bothers me though is that there seems to be no way to copy an iterator. How does one work around this? Is there a trick that I am missing? ...
5
by: ferran | last post by:
Hi, I'm trying to convert a string to a long double using streams but for some reasing seems to give the wrong values, the idea is to do a precise textual conversion without roundings or...
8
by: grahamo | last post by:
Hi, I have written an app that uses streams in a very standard way. I make use of some legacy code something like this; // legacy operator<< , standard enough. ostream&...
3
by: Tron Thomas | last post by:
What does binary mode for an ofstream object do anyway? Despite which mode the stream uses, operator << writes numeric value as their ASCII representation. I read on the Internet that it is...
11
by: Kobu | last post by:
I have a question about C's abstract "streams" (that I can't seem to FULLY understand from reading several tutorials). Streams seems to suggest that input can be treated continously if needed....
2
by: bonk | last post by:
Hello how do I connect streams in c# ? Imagine the followung scenario: I have a StreamWriter that writes Text to a Stream. How can I tell that Stream to pass that Data to another Stream...
3
by: _TR | last post by:
I love C# and I've been porting a lot of my older C++ code, but there is one app that I haven't quite figured out yet. I suppose I could re-engineer the app from the ground up, but I've already...
1
by: Chris | last post by:
I'm reading up on streams and I have two articles that seem to conflict with each other. One article describes streams and lists a few of the major ones (FileStream, Memory Stream, Network...
2
by: Abhishek | last post by:
what are the STDUPDATE, STDERR, STDOUT and STDIN streams and how does one access these streams in C language. I am aware of the function fprintf(FILE *fp, char * format, char *s) which puts the...
3
by: Kirit Sælensminde | last post by:
>From thread http://groups.google.com/group/comp.lang.c++/browse_thread/thread/79d767efa42df516 "P.J. Plauger" <p...@dinkumware.comwrites: I'll take this at face value and I'll have to suppose...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.