By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,075 Members | 957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,075 IT Pros & Developers. It's quick & easy.

Where did my console output go?

P: n/a
Hello,

I am writing code that uses a DLL which is supposed to print to
console
some useful information but for some reason it is not doing so. The
environment
is a bit complex to explain but here it goes:

- I am using a C library called SYMPHONY, which I compiled myself.
When using that
library in an standard console application I get the console output
right.

- I wrote a wrapper for the library in C to hook it into Matlab via
mex-files (which
are C files compiled to DLLs, but with a different name)

- This wrapper altogether with the library is used in a Matlab
program. From inside
Matlab the SYMPHONY output doesn't show up.

- This Matlab program is compiled into a .NET component which when
used by
a console application in Visual Studio shows all the information i was
missing in
the previous step.

Since I am not understanding what is going on right here I would like
to write
all the information that sometimes appears in the console (and
sometimes not)
to a file, but without the need to modify the SYMPHONY library that I
built in
the first step.

Is there anything in the C standard library that can help me with
this?

Thanks in advance,

Carlos Martínez
Oct 30 '08 #1
Share this Question
Share on Google+
27 Replies


P: n/a
CarlosMB wrote:
Hello,

I am writing code that uses a DLL which is supposed to print to
console
some useful information but for some reason it is not doing so. The
environment
is a bit complex to explain but here it goes:

- I am using a C library called SYMPHONY, which I compiled myself.
When using that
library in an standard console application I get the console output
right.

- I wrote a wrapper for the library in C to hook it into Matlab via
mex-files (which
are C files compiled to DLLs, but with a different name)

- This wrapper altogether with the library is used in a Matlab
program. From inside
Matlab the SYMPHONY output doesn't show up.

- This Matlab program is compiled into a .NET component which when
used by
a console application in Visual Studio shows all the information i was
missing in
the previous step.

Since I am not understanding what is going on right here I would like
to write
all the information that sometimes appears in the console (and
sometimes not)
to a file, but without the need to modify the SYMPHONY library that I
built in
the first step.

Is there anything in the C standard library that can help me with
this?

Thanks in advance,

Carlos Martínez

Hola Carlos

Answer in Spanish so the pedants in this group do not get it!

Lo mejor que puedes hacer es llamar la funcion

AllocConsole();

cuando comienzas tu programa. Esto va FORZAR la existencia de una
consola. Probablemente sabes ya que programas utilizando solamente
windows no crean una consola.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Oct 30 '08 #2

P: n/a
On 30 Oct, 10:11, jacob navia <ja...@nospam.comwrote:
CarlosMB wrote:
I am writing code that uses a DLL which is supposed to print to
console
some useful information but for some reason it is not doing so. The
environment
is a bit complex to explain but here it goes:
- I am using a C library called SYMPHONY, which I compiled myself.
When using that
library in an standard console application I get the console output
right.
- I wrote a wrapper for the library in C to hook it into Matlab via
mex-files (which
are C files compiled to DLLs, but with a different name)
- This wrapper altogether with the library is used in a Matlab
program. From inside
Matlab the SYMPHONY output doesn't show up.
- This Matlab program is compiled into a .NET component which when
used by
a console application in Visual Studio shows all the information i was
missing in
the previous step.
Since I am not understanding what is going on right here I would like
to write
all the information that sometimes appears in the console (and
sometimes not)
to a file, but without the need to modify the SYMPHONY library that I
built in
the first step.
Is there anything in the C standard library that can help me with
this?
Thanks in advance,
*Carlos Martínez

Hola Carlos

Answer in Spanish so the pedants in this group do not get it!

Lo mejor que puedes hacer es llamar la funcion

AllocConsole();

cuando comienzas tu programa. Esto va FORZAR la existencia de una
consola. Probablemente sabes ya que programas utilizando solamente
windows no crean una consola.
comp.lang.c is an English language news group and posting should
be restricted to that language.
;-)

--
Nick Keighley
Oct 30 '08 #3

P: n/a
jacob navia wrote:
CarlosMB wrote:
>Hello,

I am writing code that uses a DLL which is supposed to print to
console
some useful information but for some reason it is not doing so. The
environment
is a bit complex to explain but here it goes:

- I am using a C library called SYMPHONY, which I compiled myself.
When using that
library in an standard console application I get the console output
right.

- I wrote a wrapper for the library in C to hook it into Matlab via
mex-files (which
are C files compiled to DLLs, but with a different name)

- This wrapper altogether with the library is used in a Matlab
program. From inside
Matlab the SYMPHONY output doesn't show up.

- This Matlab program is compiled into a .NET component which when
used by
a console application in Visual Studio shows all the information i was
missing in
the previous step.

Since I am not understanding what is going on right here I would like
to write
all the information that sometimes appears in the console (and
sometimes not)
to a file, but without the need to modify the SYMPHONY library that I
built in
the first step.

Is there anything in the C standard library that can help me with
this?
No. That kind of thing is in the domain of your windowing system, not
the C standard.
>Thanks in advance,

Carlos Martínez


Hola Carlos

Answer in Spanish so the pedants in this group do not get it!
That's ridiculous. You're assuming he can read it, just because he's got
a Hispanic name, and you're assuming that we can't read it just because
-- it's not actually clear why you've made that assumption, but I'm at
least one counterexample. From the message he sent, the only language
you can be certain that he is fluent in is English, and he seems fairly
fluent in it.
Lo mejor que puedes hacer es llamar la funcion

AllocConsole();
He was very specific about this: he asked for a C standard library
function. AllocConsole() is not in the C standard library. You did not
answer the question he asked, you answered a different question of your
own devising.
cuando comienzas tu programa. Esto va FORZAR la existencia de una
consola. Probablemente sabes ya que programas utilizando solamente
windows no crean una consola.
Even if he had asked for a Windows-specific answer, rather than a C
standard library answer, you would still have done him a better service
by redirecting his inquiry to a forum devoted to the kind of system he's
using. In that forum, he'd have a better chance than he has here of
hearing from someone else whether or not your advice makes any sense.
Oct 30 '08 #4

P: n/a
Nick Keighley wrote:
jacob navia <ja...@nospam.comwrote:
.... snip ...
>
>Answer in Spanish so the pedants in this group do not get it!
Lo mejor que puedes hacer es llamar la funcion

AllocConsole();

cuando comienzas tu programa. Esto va FORZAR la existencia de una
consola. Probablemente sabes ya que programas utilizando solamente
windows no crean una consola.

comp.lang.c is an English language news group and posting should
be restricted to that language.
No it isn't. However it is a public newsgroup, and private
communications should be done via e-mail. Attempts to use it for
private communications is a very bad error by Mr Navia. Public
communications are much more likely to be understood by all when
done in English, or a reasonable approximation thereto.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Oct 30 '08 #5

P: n/a
Nick Keighley said:
On 30 Oct, 10:11, jacob navia <ja...@nospam.comwrote:
<snip>
>Lo mejor que puedes hacer es llamar la funcion

AllocConsole();

cuando comienzas tu programa. Esto va FORZAR la existencia de una
consola. Probablemente sabes ya que programas utilizando solamente
windows no crean una consola.

comp.lang.c is an English language news group and posting should
be restricted to that language.
I don't think that's actually written down anywhere official.

If your Spanish is on a par with mine, you can always resort to
piscilation, according to which Mr Navia wrote:

"The best thing than you can do is to call the function AllocConsole ();
when you begin your program. This goes TO FORCE the existence of a
console. Probably you know since programs only using Windows do not create
a console."

It is not clear whether this has any relevance whatsoever to the OP's
question. The OP may simply have been using the word "console" to describe
a bog-standard stdin/stdout system.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 30 '08 #6

P: n/a
CarlosMB wrote:
Hello,

I am writing code that uses a DLL which is supposed to print to
console
some useful information but for some reason it is not doing so. The
environment
is a bit complex to explain but here it goes:

- I am using a C library called SYMPHONY, which I compiled myself.
When using that
library in an standard console application I get the console output
right.

- I wrote a wrapper for the library in C to hook it into Matlab via
mex-files (which
are C files compiled to DLLs, but with a different name)

- This wrapper altogether with the library is used in a Matlab
program. From inside
Matlab the SYMPHONY output doesn't show up.
My (limited) experience is that the presence or otherwise of a console
window depends on the link options used (eg console or windows).

If you don't have control of this, then Jacob's AllocConsole() idea might be
work (for all I know, all the link option does might be to call this at
startup).

However when I tried this in an experiment, I couldn't get any output on the
console, not with printf() anyway. And none of this is standard C either.

--
Bartc

Oct 30 '08 #7

P: n/a
CarlosMB wrote:
>
Hello,

I am writing code that uses a DLL which is supposed to print to
console
some useful information but for some reason it is not doing so. The
environment
Try:

#ifdef debug
void init_stdout()
{int hCrt;
FILE *hf;

AllocConsole();
hCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HAND LE),_O_TEXT);
hf = _fdopen( hCrt, "w" );
*stdout = *hf;
setvbuf( stdout, NULL, _IONBF, 0 );
printf("stdout is working!!!\n");

hCrt = _open_osfhandle((long)GetStdHandle(STD_INPUT_HANDL E),_O_TEXT);
hf = _fdopen( hCrt, "r" );
*stdin = *hf;
setvbuf( stdin, NULL, _IONBF, 0 );

printf("type a character followed by a <CRto test stdin: ");
/*printf("\nYou typed: %c\n",getchar()); */
}
#endif
Oct 30 '08 #8

P: n/a
In article <da**********************************@d45g2000hsc. googlegroups.com>,
CarlosMB <ca*********@gmail.comwrote:
>- I am using a C library called SYMPHONY, which I compiled myself.
When using that
library in an standard console application I get the console output
right.
That seems to indicate that the library is writing its output to
stdout. (Either that or it's playing Windows-specific games with the
output, which puts your problem well outside the scope of comp.lang.c.)

This is not exactly a good thing for a library to do, since it's likely
to, at some point (like in your project), be used in a program where
stdout isn't the right place for output to go.

>- I wrote a wrapper for the library in C to hook it into Matlab via
mex-files (which
are C files compiled to DLLs, but with a different name)

- This wrapper altogether with the library is used in a Matlab
program. From inside
Matlab the SYMPHONY output doesn't show up.
Check the SYMPHONY documentation to see if you can find a way to have
the output go through a function you provide instead of just being
written to stdout. If you can do that, you can just have your mex-file
wrapper send it through the appropriate Matlab output function[1]
instead of to stdout. (Applications that have stdout attached can keep
just using the default.)

If the library doesn't support this and insists on always sending its
output to stdout, there's not much you can do without either modifying
the library or convincing the maintainers of the library to modify it
for you.
[Snip description of running under Matlab with a console window open -
I believe the Windows stdio library will always output to the process's
console window if there is one, which is consistent with the described
behavior]

>Is there anything in the C standard library that can help me with
this?
Not if you can't redirect the output through something other than the
standard library's stdio functions and need portable C code.

You may be able to persuade the stdio library to create an output
stream that gives you the data that's written to it. If you can do
this, and if you can persuade the library you're using to write to such
a stream (you may need to modify stdout and/or stderr to accomplish
this), you can capture the output and send it somewhere appropriate.
There is no portable way to do this, but if you're willing to tie your
code down to a particular platform, you may be able to find something
that will work.
dave
[1] I happen to have the Matlab External Interfaces manual on my
bookshelf, and it indicates that mexPrintf is probably the function
you want for this. But a Matlab newsgroup would be a much better
place to discuss Matlab's foreign code support.

--
Dave Vandervies dj3vande at eskimo dot com
Begods, an optimist!
I thought we'd killed the last of that breed ages since!
--Dan Holdsworth in the scary devil monastery
Oct 30 '08 #9

P: n/a
jacob navia <ja***@nospam.comwrote:
CarlosMB wrote:
Is there anything in the C standard library that can help me with
this?
>
Hola Carlos

Answer in Spanish so the pedants in this group do not get it!
So let's get this straight. You're going for the triple whammy here.
You're an idiot, you're dishonest...
Lo mejor que puedes hacer es llamar la funcion

AllocConsole();

cuando comienzas tu programa.
...._and_ you're wrong. Well done.

Richard
Oct 31 '08 #10

P: n/a
Richard Bos wrote:
You're an idiot, you're dishonest...

So, you think you can insult anyone like that ?

You, and the other cowards here, are only "strong" when
insulting. Then, you feel good.

Unable to argument anything the only thing your feeble brain is able
to do is that: insulting.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Oct 31 '08 #11

P: n/a
jacob navia wrote:
Richard Bos wrote:
>jacob navia wrote:
>>CarlosMB wrote:

Is there anything in the C standard library that can help me
with this?

Hola Carlos

Answer in Spanish so the pedants in this group do not get it!

So let's get this straight. You're going for the triple whammy
here. You're an idiot, you're dishonest...
>>Lo mejor que puedes hacer es llamar la funcion

AllocConsole();

cuando comienzas tu programa.

..._and_ you're wrong. Well done.

So, you think you can insult anyone like that ?

You, and the other cowards here, are only "strong" when insulting.
Then, you feel good. Unable to argument anything the only thing
your feeble brain is able to do is that: insulting.
You ingeniously trimmed away the insults and Usenet misuse you
supplied. I have attempted to restore them, and I think I got the
attributions correct. Just to establish exactly who is misusing
the Usenet system. And who is insulting whom.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Nov 1 '08 #12

P: n/a
CBFalconer wrote:
jacob navia wrote:
>Richard Bos wrote:
>>jacob navia wrote:
CarlosMB wrote:

Is there anything in the C standard library that can help me
with this?
Hola Carlos

Answer in Spanish so the pedants in this group do not get it!
So let's get this straight. You're going for the triple whammy
here. You're an idiot, you're dishonest...

Lo mejor que puedes hacer es llamar la funcion

AllocConsole();

cuando comienzas tu programa.
..._and_ you're wrong. Well done.
So, you think you can insult anyone like that ?

You, and the other cowards here, are only "strong" when insulting.
Then, you feel good. Unable to argument anything the only thing
your feeble brain is able to do is that: insulting.

You ingeniously trimmed away the insults and Usenet misuse you
supplied.
Lying again. I did notinsult anyone. At most I tried to avoid
the pedants in this group.
I have attempted to restore them, and I think I got the
attributions correct.
Yes. As anyone can see, I did not insult anyone.
Just to establish exactly who is misusing
the Usenet system. And who is insulting whom.
Exactly. None of the quoted material attributed to me has any insults
like "idiot".
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Nov 1 '08 #13

P: n/a
jacob navia said:
CBFalconer wrote:
>jacob navia wrote:
>>Richard Bos wrote:
jacob navia wrote:
CarlosMB wrote:
>
>Is there anything in the C standard library that can help me
>with this?
Hola Carlos
>
Answer in Spanish so the pedants in this group do not get it!
So let's get this straight. You're going for the triple whammy
here. You're an idiot, you're dishonest...

Lo mejor que puedes hacer es llamar la funcion
>
AllocConsole();
>
cuando comienzas tu programa.
..._and_ you're wrong. Well done.
So, you think you can insult anyone like that ?

You, and the other cowards here, are only "strong" when insulting.
Then, you feel good. Unable to argument anything the only thing
your feeble brain is able to do is that: insulting.

You ingeniously trimmed away the insults and Usenet misuse you
supplied.

Lying again. I did notinsult anyone.
You don't think that calling people cowards and liars counts as insulting
them?
At most I tried to avoid the pedants in this group.
Did it work?
>I have attempted to restore them, and I think I got the
attributions correct.

Yes. As anyone can see, I did not insult anyone.
In making the claim that you didn't insult anyone, you seem to have
overlooked the parts where you insulted people.
>Just to establish exactly who is misusing
the Usenet system. And who is insulting whom.

Exactly. None of the quoted material attributed to me has any insults
like "idiot".
"You, and the other cowards here". "Lying again". Both of these are
considered insulting. Also, it is clear from context that you consider the
word "pedants" to be insulting. (Those whom you insult in such a way,
however, are unlikely to be bothered by the word, since to them it simply
means "people who care about getting it right", which is clearly not a
major concern of yours.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 1 '08 #14

P: n/a
On Nov 1, 3:17 pm, Richard Heathfield <r...@see.sig.invalidwrote:
jacob navia said:
<snip>
"You, and the other cowards here". "Lying again". Both of these are
considered insulting. Also, it is clear from context that you consider the
word "pedants" to be insulting. (Those whom you insult in such a way,
however, are unlikely to be bothered by the word, since to them it simply
means "people who care about getting it right", which is clearly not a
major concern of yours.
You forgot the closing paren ).
:-)
Nov 1 '08 #15

P: n/a
vi******@gmail.com said:
On Nov 1, 3:17 pm, Richard Heathfield <r...@see.sig.invalidwrote:
>jacob navia said:

<snip>
>"You, and the other cowards here". "Lying again". Both of these are
considered insulting. Also, it is clear from context that you consider
the word "pedants" to be insulting. (Those whom you insult in such a
way, however, are unlikely to be bothered by the word, since to them it
simply means "people who care about getting it right", which is clearly
not a major concern of yours.

You forgot the closing paren ).
:-)
You person who care about getting it right, you!

But of course you're correct. I forgot to compile before posting.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 1 '08 #16

P: n/a
On 1 Nov 2008 at 13:17, Richard Heathfield wrote:
You don't think that calling people cowards and liars counts as
insulting them?
If someone makes a deliberately false statement to try to undermine
another's reputation, is it an insult to call them a liar, or simply a
statement of fact?
(Those whom you insult in such a way, however, are unlikely to be
bothered by the word, since to them it simply means "people who care
about getting it right", which is clearly not a major concern of
yours.
Less than two hours ago, you said on this board:
either put up with him or plonk him, I guess - but picking on people
is just plain wrong.
and here you are carrying on with your nasty, insidiious campaign of
bullying against Jacob. What a despicable little weasel you are.

Nov 1 '08 #17

P: n/a
One of the many questions asked by people is that even if they write
into standard output, the output doesn't show in the screen. This
happens in windows systems since quite a long time.

To avoid this, you should open a console before outputting anything
into standard output. You do this with

void AllocConsole(void);

When you do not want to use the console any more (and you do not
want the ugly black window hanging around) you just do:
BOOL WINAPI FreeConsole(void);

The operating system opens up a console for all programs that
have the bit of "console application" set in the executable. That is
why you do NOT needto open a console for those programs. Programs
that need this are only programs that were compiled with the
"subsystem windows" bit set.

-------------------------------------------------------------------

You find this off topic for clc?

You can go to hell. There, you can complain to the boss.

You find me obnoxious?

You can go to heaven and complain there to the boss.
Nov 1 '08 #18

P: n/a
Antoninus Twink wrote:
On 1 Nov 2008 at 13:17, Richard Heathfield wrote:
>You don't think that calling people cowards and liars counts as
insulting them?

If someone makes a deliberately false statement to try to undermine
another's reputation, is it an insult to call them a liar, or simply a
statement of fact?
I did not insult anyone.

Boss insulted me treating me of idiot.

I told him he was a coward.

Falconer quoted the conversation saying I was the one
insulting.

Heathfield starts after Falconer continuing the story that
it is me that is insulting people.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Nov 1 '08 #19

P: n/a

This supposed FAQ intrigues me, though I may regret asking about it.

jacob navia <ja***@nospam.comwrites:
One of the many questions asked by people is that even if they write
into standard output, the output doesn't show in the screen. This
happens in windows systems since quite a long time.

To avoid this, you should open a console before outputting anything
into standard output. You do this with

void AllocConsole(void);
Is there not a way do get the same effect without using non-portable
constructs? I don't use Windows so I am often amazed at what people
say is needed to get X to work or Y to do the "usual" thing, but is it
really that odd a system? Is there no way to run a standard C program
that reads stdin and writes stdout in a usable way?

<snip OS details>
You find this off topic for clc?
Personally, no. If it means that standard C is not a usable option
for such simple programs, then I think the warning is topical.
Alternatives are not hard to come by if you are a beginner learning C.

--
Ben.
Nov 1 '08 #20

P: n/a
CBFalconer wrote:
jacob navia wrote:
>Richard Bos wrote:
>>jacob navia wrote:
CarlosMB wrote:

Is there anything in the C standard library that can help me
with this?
Hola Carlos

Answer in Spanish so the pedants in this group do not get it!
So let's get this straight. You're going for the triple whammy
here. You're an idiot, you're dishonest...

Lo mejor que puedes hacer es llamar la funcion

AllocConsole();

cuando comienzas tu programa.
..._and_ you're wrong. Well done.
So, you think you can insult anyone like that ?

You, and the other cowards here, are only "strong" when insulting.
Then, you feel good. Unable to argument anything the only thing
your feeble brain is able to do is that: insulting.

You ingeniously trimmed away the insults and Usenet misuse you
supplied. I have attempted to restore them, and I think I got the
attributions correct. Just to establish exactly who is misusing
the Usenet system. And who is insulting whom.
I most emphatically deny that the term "pedant", as used by jacob navia,
counts as an insult. Whether or not he intends it as such, the way he
uses it is as a term that describes anyone who cares more about the
accuracy of what he's saying than jacob does, and that's a pretty low
standard to measure pedantry by.

Nov 1 '08 #21

P: n/a
On Nov 1, 8:17*am, Richard Heathfield <rj*@see.sig.invalidwrote:
(Those whom you insult in such a way,
however, are unlikely to be bothered by the word, since to them it simply
means "people who care about getting it right",
But pedants don't usually get things right (alas, they don't usually
get things even *done*; they just know how to criticize :-)

Sebastian

Nov 1 '08 #22

P: n/a
Ben Bacarisse wrote:
This supposed FAQ intrigues me, though I may regret asking about it.

jacob navia <ja***@nospam.comwrites:
>One of the many questions asked by people is that even if they write
into standard output, the output doesn't show in the screen. This
happens in windows systems since quite a long time.

To avoid this, you should open a console before outputting anything
into standard output. You do this with

void AllocConsole(void);

Is there not a way do get the same effect without using non-portable
constructs?
Yes, compile your program as a console program, and windows
will open a console window for you.


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Nov 1 '08 #23

P: n/a
jacob navia said:
Antoninus Twink wrote:
>On 1 Nov 2008 at 13:17, Richard Heathfield wrote:
>>You don't think that calling people cowards and liars counts as
insulting them?

If someone makes a deliberately false statement to try to undermine
another's reputation, is it an insult to call them a liar, or simply a
statement of fact?

I did not insult anyone.

Boss insulted me treating me of idiot.

I told him he was a coward.

Falconer quoted the conversation saying I was the one
insulting.
If (and please note the "if") - IF I were to call you a coward (which I am
not), would I be insulting you?

IF I were to call you a liar, would I be insulting you?

If you think it's insulting to call you a coward and a liar, why don't you
think it's insulting for you to call other people cowards and liars? And
if you don't think it's insulting to call you a coward and a liar, several
questions arise:

(a) what would you call such attacks, if not insulting?
(b) what /do/ you consider insulting?
(c) do you appreciate that other people /do/ find those words insulting?
Heathfield starts after Falconer continuing the story that
it is me that is insulting people.
I am not saying you were the first to insult anyone. (I haven't checked
whether you were or not, and I don't plan to.) I am not saying you are the
*only* one to insult anyone, either. But you *have* been insulting. If it
was not your intent to call people liars and cowards - a typo, perhaps? -
then perhaps you may find it useful to publish a clarification as to what
you really meant to call them.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 1 '08 #24

P: n/a
Ben Bacarisse said:
>
This supposed FAQ intrigues me, though I may regret asking about it.

jacob navia <ja***@nospam.comwrites:
>One of the many questions asked by people is that even if they write
into standard output, the output doesn't show in the screen. This
happens in windows systems since quite a long time.

To avoid this, you should open a console before outputting anything
into standard output. You do this with

void AllocConsole(void);

Is there not a way do get the same effect without using non-portable
constructs?
Yes, of course there is.

I have a number of Windows compilers, and every one of them supports stdin,
stdout, and stderr correctly.

Incidentally, the prototype shown above does not agree with Microsoft's
prototype for their AllocConsole function. Those who would like to know
more about AllocConsole can find out either on MSDN or
comp.os.ms-windows.programmer.win32 - which is where Mr Navia's original
article should have been posted.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 1 '08 #25

P: n/a
Ben Bacarisse wrote:
Is there not a way do get the same effect without using non-portable
constructs? I don't use Windows so I am often amazed at what people
say is needed to get X to work or Y to do the "usual" thing, but is it
really that odd a system? Is there no way to run a standard C program
that reads stdin and writes stdout in a usable way?
Yes, of course.
But (unsurprisingly) when you begin your programme with the GUI entry
points, you get a GUI application with no console. The trick is... wait
for it... to use Standard C...

--
Mark McIntyre

CLC FAQ <http://c-faq.com/>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
Nov 1 '08 #26

P: n/a
Mark McIntyre wrote:
Ben Bacarisse wrote:
>Is there not a way do get the same effect without using non-portable
constructs? I don't use Windows so I am often amazed at what people
say is needed to get X to work or Y to do the "usual" thing, but is it
really that odd a system? Is there no way to run a standard C program
that reads stdin and writes stdout in a usable way?

Yes, of course.
But (unsurprisingly) when you begin your programme with the GUI entry
points, you get a GUI application with no console. The trick is... wait
for it... to use Standard C...
It is not an entry point stuff. You can write a full GUI application
starting with main() and NOT WinMain, as it was under windows 16 bits.

It is a flag in the executable that tells windows if it should open a
console or not. But even if you compile a console application you
have all the windows API available to you anyway.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Nov 1 '08 #27

P: n/a
Ben Bacarisse wrote:
jacob navia <ja***@nospam.comwrites:
>One of the many questions asked by people is that even if they
write into standard output, the output doesn't show in the
screen. This happens in windows systems since quite a long time.

To avoid this, you should open a console before outputting
anything into standard output. You do this with

void AllocConsole(void);

Is there not a way do get the same effect without using non-
portable constructs? I don't use Windows so I am often amazed at
what people say is needed to get X to work or Y to do the "usual"
thing, but is it really that odd a system? Is there no way to
run a standard C program that reads stdin and writes stdout in a
usable way?

<snip OS details>
>You find this off topic for clc?

Personally, no. If it means that standard C is not a usable
option for such simple programs, then I think the warning is
topical. Alternatives are not hard to come by if you are a
beginner learning C.
Actually, there is no need to use these off-topic actions. By
executing 'command' or 'cmd' (depending on Windows system) you have
a CL system available to you, and you simply run your program in
it. You can have several such CL windows available if you wish. I
simply launch that window at boot-up, and it is there for use as I
wish. It takes very few resources.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Nov 2 '08 #28

This discussion thread is closed

Replies have been disabled for this discussion.