Solved

Language: C  - Question

Posted on 2004-04-01
11
329 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.
0
Comment
Question by:palm_3333
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 2

Expert Comment

by:funvill
ID: 10737148
smells like homework
http://www.experts-exchange.com/Programming/help.jsp#hi56

Corect me if i'm wrong :)
0
 

Author Comment

by:palm_3333
ID: 10737172
you are VERY wrong!
I would just like to know, my C Language book dosen't tell me.....
0
 

Author Comment

by:palm_3333
ID: 10737189
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 )
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:palm_3333
ID: 10737294
Can anyone Help me with this?
0
 
LVL 2

Expert Comment

by:funvill
ID: 10737374
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 ?
0
 

Author Comment

by:palm_3333
ID: 10737396
C Primer Plus........
0
 
LVL 5

Expert Comment

by:jerry_jeremiah
ID: 10738370
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 );
0
 
LVL 37

Accepted Solution

by:
Harisha M G earned 150 total points
ID: 10739028
Don't forget double-quote!

printf("Hello world");
FILE *f;
if (f=fopen("hllowrld.txt", "w" ))
{
    fprintf(stream,"Hello world");
}
fclose( stream );

0
 
LVL 2

Expert Comment

by:funvill
ID: 10739050
oops
oops
i guess its not that basic.... :p
0
 
LVL 5

Expert Comment

by:jerry_jeremiah
ID: 10739618
he he!  I didn't notice the missing double quote either...

Jerry
0
 

Author Comment

by:palm_3333
ID: 10739763
Thank you all!  - Making a calculator, wanted output saved. -
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question