== PC == The following a few C-codes are taken from PC :
How to print a text? : | print.c | |
How to open an external text file? : | read_external_file.c | |
How to read any filename?: | read_any_filename.c | |
How to write an external file? : | write_external_file.c | |
How to handle different folders?: | filename_with_folder.c |
== PC_MAC(s)_Linux(Unix) ==
How to delimit folder (directory) structure ? :
Backslash (\) for PC.
Colon (:) for vintage Mac.
Regular slash (/) for Mac_OSX and Linux_Unix.
When you port the codes from one platform to another, make sure
to adjust them.
Backslash (\) for PC.
Colon (:) for vintage Mac.
Regular slash (/) for Mac_OSX and Linux_Unix.
When you port the codes from one platform to another, make sure
to adjust them.
== Linux_MacOSX == How to use GCC C-compiler? :
$ gcc print.c
$ cc print.c
$ cc print.c
gcc and cc often work synonymously.
Those aboves create a.out which is an executable.
If you want to name an executable output, for example, my.exe,
Those aboves create a.out which is an executable.
If you want to name an executable output, for example, my.exe,
$ gcc -o my.exe print.c
Just compiling a piece of C code (.c) file as an object file (.o),
$ gcc -c recycle.c
== Linux_MacOSX == How to use Makefile?:
Make sure the content of Makefile generally follows the compilation
grammar above. Then at the same directory with Makefile, just type,
$ make
If Makefile contains installation command lines, then type,
$ make install
== Bibliography ==
The below is the original standard textbook from C developers. This isn't an easy book, but it comes with history of development, so you better have it. Since this textbook tells all the essentials in terse words, it is an idea to find another textbook for easy comprehension and practices. Look for around at a bookstore's shelf.
[ The C Programming Language ] by Brian W. Kernighan, Dennis M. Ritchie (Bell Telephone Laboratories); such as Second Edition (1988) ISBN: 0-13-110362-8, PTR Prentice-Hall, Englewood Cliffs, NJ 07632.