[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: g++ file doesn't run



On Mar 03, 1997 at 10:23:30PM -0500, Jeff Shilt wrote:
> Thanks for the help - it does compile with g++ instead of gcc, but the executable produced isn't doing anything.  Here's what i'm doing:
> 
> //test.c
> #include <iostream.h>
> 
> main(){
>   cout << "Hello there.";
> }
> 
> The test file doesn't print out anything when I run it.

As I understand it, Unix terminal IO is buffered, so nothing will
be written until a newline is sent. You never sent one, so all
bets are off; the standards don't guarantee anything if you don't
send at least one new line. (Similarly by default even character
by character input won't see anything until the user presses return).

Try

#include <iostream.h>

main()
{
    cout << "Hello there." << endl;
}

You would theoretically get no output from

#include <stdio.h>

main()
{
    printf("Hello there.");
}

either. I haven't checked though.


Hamish
-- 
Hamish Moffatt, moffatt@yallara.cs.rmit.edu.au,     Melbourne, Australia.
Student, computer science & computer systems engineering. 3rd year, RMIT.
http://yallara.cs.rmit.edu.au/~moffatt             CPOM: [****      ] 40%
PGP key available from web page above.


Reply to: