Thursday, January 20, 2011

5 steps to reedite your C source code file

Source code is not carved in stone — or silicon, for that matter. It can be changed. Sometimes, the changes are necessary, in the case of errors and boo-boos. At other times, you may just want to modify your program, adding a feature or changing a message or prompt — what the hard-core C geeks call tweaking or twiddling. To do that, you have to reedit your source code file.

For example, the GOODBYE program from Chapter 1 displays a message on the screen:
Goodbye, cruel world!

This program can easily be modified to show any message you like. To do so, use your editor and change the source code file, replacing the original mes­sage with your newer, pithier message. Follow these steps:

1.  Use your text editor to reedit the GOODBYE.C source code.

2.  Edit Line 5, which looks like this:
printf(“Goodbye, cruel world!\n”);

3.  Replace the text Goodbye, cruel world! with Farewell, you ugly toad!
printf(“Farewell, you ugly toad!\n”);

Change only the text between the double quotes. That’s the information that is displayed on the screen. Everything else — don’t touch!

4.  Double-check your work.

5.  Save the file to disk.
It’s okay to overwrite the original; your modified file becomes the new GOODBYE.C source code file.
Now you’re ready to recompile your source code, as covered in the next section.


“Reedit your source code file” means to use your text editor to modify the source code, the text file that contains the C language instructions.

You reedit the source code file to repair an error caught by the compiler or linker or to modify the program. This situation happens a lot.

If you’re using the command prompt to run your editor, don’t forget that you can use the up-arrow key to recall previous commands (in certain command-prompt environments). In this case, press the up-arrow key a few times until the original command to edit the GOODBYE.C source code file reappears at the prompt.

Welcome to reproduce this passage. Please indicate the source when you reproduce this passage.
Source: C Language 
Paid Recommendations: Convert DVD To AVI . Rip the DVD movie to your computer, protect your DVD. Convert DVD to mp3. Convert DVD to mp4
Find out more at 
http://www.daniusoft.com/dvd-ripper.html

No comments:

Post a Comment