Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Language: C  - Question

Posted on 2004-04-01
11
Medium Priority
?
359 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 450 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Progress

916 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