Exercises, examples and other material relating to training module C210. This topic is presented on public courses Learning to Program in C
, Learning to program in C++
, Programming in C
, C and C++ Programming
How to open, read, write, and close files in C; how to
check whether or not a file exists, and how to find out the
names of all the files (and subdirectories too) in a directory.
|Articles and tips on this subject||updated|
|3386||Adding the pieces together to make a complete language - C|
Once we've covered the fundamentals of programming on a C course, we move on to cover pointers, arrays, structures, strings, input/output, and dynamic memory allocation. We teach and illustrate each of them, and we have our delegates write practical exercises to make sure that they have a grasp of ...
|3122||When is a program complete?|
"Code is never completed ... it can always be improved." ... it's one of the most difficult aspects in many projects to say "yes, that does what we want and we should go for a release now rather than continuing to develop until ... until it's so late that we've missed the boat / added too much complexity ...
|2572||The what and why of C pointers|
If you put a "*" in front of a variable name as you declare the variable in C, that variable holds the ADDRESS of a value of the type give, rather than the value itself. Thus:
int bill; /* holds an integer */
int *ben; /* holds an ADDRESS. At that address you'll find an integer ...
|2571||Reading and writing files in C|
In C you can use either open or fopen to open a file. open is what you would use for binary files, and you have plenty of low level controls; use fopen for text files.
When you fopen a file, you'll get back a pointer to a structure of type FILE which you then pass into function such as fgets and fprintf.
|2002||New C Examples - pointers, realloc, structs and more|
Every time I program in C, I marvel at how clever the language is ... yet at the same time I curse some of the devices that are used to perform certain actions, which make the code that much more of a 'puzzle' to right.
I've finished a 2 day C Programming course today ... and written a whole raft ...
Examples from our training material
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from http://www.training-notes.co.uk
Topics covered in this module
stdio.h and other headers.
Files and other streams.
Opening and closing.
Reading and writing.
Checking files and directories.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.