Doublecheck that you have the include directory in the Makefile set properly or if you are compiling from the command line that you have the -i option pointing to the include directory. This is a common problem when learning how to compile. If you use a Makefile add
INCLUDE_DIR=-i /directory/path/to/include-files
If you are compiling at the command line
gcc program-name.c -i/directory/path/to/include-files executable-name
fopen can be used for reading/writing from/to files and in some cases character devices (/dev/device) can be accessed via file I/O. Your SD card should be 'mounted' and listed in the device table (/dev). 'rm /dev' should enumaerate the devices.
Here is a link to an overview of C file I/O.
http://www.cprogramming.com/tutorial/cfileio.html
and here is an example for reading/writing using fopen.
http://www.tutorialspoint.com/c_standard_library/c_function_fread.htm
If you are using Linux the sdcard will appear as a device somewhere in the device table. Read up on how Linux enumerates storage devices or devices in general. Read also how to point to a certain device and filename. If you execute your program in the same directory as the file it will be just the filename (i.e. tomas.txt) but if it is on another device (or directory) the filename may be something like /dev/sdc1/project1/tomas.txt (tomas.txt on an extedrnal sdcard). Once you understand how paritioning and the directory structure is enumerated in Linux then you will be able to locate any file on any device. In some cases you be able to access a device directly such as /dev/ttyS0 (for the first serial device) and read/write to the device
Welcome to the world of C programming. Having done embedded devices for the last decade I find that the C programming language is the language of choice for writing drivers, and can also be used for writing applications. C++ (a whole new bag of worms) can be used for writing applications as well.
Cheers,
Glen