Solved

Language: C  - Question

Posted on 2004-04-01
11
311 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
Comment Utility
smells like homework
http://www.experts-exchange.com/Programming/help.jsp#hi56

Corect me if i'm wrong :)
0
 

Author Comment

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

Author Comment

by:palm_3333
Comment Utility
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
 

Author Comment

by:palm_3333
Comment Utility
Can anyone Help me with this?
0
 
LVL 2

Expert Comment

by:funvill
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:palm_3333
Comment Utility
C Primer Plus........
0
 
LVL 5

Expert Comment

by:jerry_jeremiah
Comment Utility
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
Comment Utility
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
Comment Utility
oops
oops
i guess its not that basic.... :p
0
 
LVL 5

Expert Comment

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

Jerry
0
 

Author Comment

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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumHeights  challenge 17 60
mergeTwo  challenge 13 71
VB6 Compile Compatibility Issue 4 26
C Programming - If Statement 8 48
Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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 …

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now