Solved

Language: C  - Question

Posted on 2004-04-01
11
344 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 236
jboss 7.1 start up error 1 60
ejb message driven bean mdb creation steps 2 34
CSV file copy field 1 to field 2 2 35
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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…

685 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