Solved

Language: C  - Question

Posted on 2004-04-01
11
337 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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?

809 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