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.
Programming

Avatar of undefined
Last Comment
palm_3333

8/22/2022 - Mon
funvill

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

Corect me if i'm wrong :)
ASKER
palm_3333

you are VERY wrong!
I would just like to know, my C Language book dosen't tell me.....
ASKER
palm_3333

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 )
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER
palm_3333

Can anyone Help me with this?
funvill

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 ?
ASKER
palm_3333

C Primer Plus........
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
jerry_jeremiah

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
Harisha M G

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
funvill

oops
oops
i guess its not that basic.... :p
jerry_jeremiah

he he!  I didn't notice the missing double quote either...

Jerry
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER
palm_3333

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