Link to home
Start Free TrialLog in
Avatar of palm_3333
palm_3333

asked on

Language: C - Question


Hello,
Could any one tell me how to make a " Hello World " in C thats uses the printf() Function that prints " Hello World " on the MS-DOS screen ( NO GUI code, just ANSI C ), than saves it to your Hard Drive (  C:\programfiles\helloworld.txt   ) as a " .TXT " with the printed words included in the executed program.
Avatar of funvill
funvill
Flag of Canada image

smells like homework
https://www.experts-exchange.com/Programming/help.jsp#hi56

Corect me if i'm wrong :)
Avatar of palm_3333
palm_3333

ASKER

you are VERY wrong!
I would just like to know, my C Language book dosen't tell me.....
I asure you this isan't " Homework ", I guess you can at least tell me how to intergrade a MSDOS output command to make a text file..... ( No DOS.h )
Can anyone Help me with this?
this is basic stuff it should be in your book


printf("hello world");
FILE *stream;
if ( stream = fopen( "helloworld.txt", "w" ) != null )
{
fprintf( stream, helloworld" );
}


what book do you have ?
C Primer Plus........
Don't forget the fclose(stream)

printf("hello world");
FILE *stream;
if ( stream = fopen( "C:\\programfiles\\helloworld.txt", "w" ) != null )
{
    fprintf( stream, helloworld" );
}
fclose( stream );
ASKER CERTIFIED SOLUTION
Avatar of Harisha M G
Harisha M G
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oops
oops
i guess its not that basic.... :p
he he!  I didn't notice the missing double quote either...

Jerry
Thank you all!  - Making a calculator, wanted output saved. -