[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] c++ & mem
> Hi there, I am using Mandrake v7.1.
> I have two hopefully easy questions:-
> 1). when I compile a c++ file e.g.
> #include <stdio.h>
>
> int main ()
> {
> printf("hi there/n");
> return 0;
> }
>
> by the command line
> g++ test.cpp
>
> it creates a file "a.out" but when I type it in on the command line it =
> does not work, just comes back with a "bash" line.
Well ... first try changing "/n" to "\n". The code also looks very C like
(ie, that isn't a C++ program). *however* it should work (it does on my
machine). I feel the problem is with the /n vs \n ... with '/n' printf will
display '/n'. With '\n' it'll do a newline. Maybe bash is doing a automatic
carrage return when the program ends ... so it'll overwrite the output.
Chris...
..<snip nasty HTML version>...
--
Chris Johnson \ "If not for me then, do it for yourself. If not
sixie@nccnet.co.uk \ for then do it for the world." -- Stevie Nicks
www.nccnet.co.uk/~sixie/ ~---------------------------------------+
Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000 \______
---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word
"unsubscribe" in the body of the message.
GNU the choice of a complete generation.