We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Language: C  - Question

palm_3333
palm_3333 asked
on
Medium Priority
380 Views
Last Modified: 2010-04-17

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.
Comment
Watch Question

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

Corect me if i'm wrong :)

Author

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

Author

Commented:
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 )

Author

Commented:
Can anyone Help me with this?

Commented:
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 ?

Author

Commented:
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 );
Engineer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
oops
oops
i guess its not that basic.... :p
he he!  I didn't notice the missing double quote either...

Jerry

Author

Commented:
Thank you all!  - Making a calculator, wanted output saved. -
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.