top/contents search

19. System Dependencies

19.1 How can I read a single character from the keyboard without waiting for the RETURN key? How can I stop characters from being echoed on the screen as they're typed?

19.2 How can I find out if there are characters available for reading (and if so, how many)? Alternatively, how can I do a read that will not block if there are no characters available?

19.3 How can I display a percentage-done indication that updates itself in place, or show one of those ``twirling baton'' progress indicators?

19.4 How can I clear the screen?
How can I print text in color?
How can I move the cursor to a specific x, y position?

19.4b I'm compiling some test programs on a windows-based system, and the windows containing my program's output are closing so quickly after my program calls exit that I can't see the output. How can I make it pause before closing?

19.5 How do I read the arrow keys? What about function keys?

19.6 How do I read the mouse?

19.7 How can I do serial (``comm'') port I/O?

19.8 How can I direct output to the printer?

19.9 How do I send escape sequences to control a terminal or other device?

19.9b How can I access an I/O board directly?

19.10 How can I do graphics?

19.10b How can I display GIF and JPEG images?

19.10c How can I load new fonts for display?

19.10d How can I send mail from within a C program?

19.11 How can I check whether a file exists? I want to warn the user if a requested input file is missing.

19.12 How can I find out the size of a file, prior to reading it in?

19.12b How can I find the modification date and time of a file?

19.13 How can a file be shortened in-place without completely clearing or rewriting it?

19.14 How can I insert or delete a line (or record) in the middle of a file?

19.15 How can I recover the file name given an open stream or file descriptor?

19.16 How can I delete a file?

19.16b How do I copy files?

19.17 Why can't I open a file by its explicit path? The call

fopen("c:\newdir\file.dat", "r")
is failing.

19.17b fopen isn't letting me open files like "$HOME/.profile" and "~/.myrcfile".

19.17c How can I suppress the dreaded MS-DOS ``Abort, Retry, Ignore?'' message?

19.18 I'm getting an error, ``Too many open files''. How can I increase the allowable number of simultaneously open files?

19.19 How can I find out how much free space is available on disk?

19.20 How can I read a directory in a C program?

19.21 How do I create a directory?
How do I remove a directory (and its contents)?

19.22 How can I find out how much memory is available?

19.23 How can I allocate arrays or structures bigger than 64K?

19.24 What does the error message ``DGROUP data allocation exceeds 64K'' mean, and what can I do about it? I thought that using large model meant that I could use more than 64K of data!

19.25 How can I access memory (a memory-mapped device, or graphics memory) located at a certain address?
How can I do PEEK and POKE in C?

19.25b How can I determine whether a machine's byte order is big-endian or little-endian?

19.26 How can I access an interrupt vector located at the machine's location 0? If I set a pointer to 0, the compiler might translate it to some nonzero internal null pointer value.

19.27 How can I invoke another program (a standalone executable, or an operating system command) from within a C program?

19.28 How can I call system when parameters (filenames, etc.) of the executed command aren't known until run time?

19.29 How do I get an accurate error status return from system on MS-DOS?

19.30 How can I invoke another program or command and trap its output?

19.31 How can my program discover the complete pathname to the executable from which it was invoked?

19.32 How can I automatically locate a program's configuration files in the same directory as the executable?

19.33 How can a process change an environment variable in its caller?

19.34 How can I open files mentioned on the command line, and parse option flags?

19.35 Is exit(status) truly equivalent to returning the same status from main?

19.36 How can I read in an object file and jump to locations in it?

19.37 How can I implement a delay, or time a user's response, with sub-second resolution?

19.38 How can I trap or ignore keyboard interrupts like control-C?

19.39 How can I handle floating-point exceptions gracefully?

19.39b How can I ensure that integer arithmetic doesn't overflow?

19.40 How do I... Use sockets? Do networking? Write client/server applications?

19.40a Can I combine .OBJ and .LIB files from Microsoft C and Turbo C?

19.40b How do I... Use BIOS calls? Write ISR's? Create TSR's?

19.40c I'm trying to compile this program, but the compiler is complaining that ``union REGS'' is undefined, and the linker is complaining that int86 is undefined.

19.40d What are ``near'' and ``far'' pointers?

19.41 But I can't use all these nonstandard, system-dependent functions, because my program has to be ANSI compatible!

19.42 Why isn't any of this standardized in C? Any real program has to do some of these things.


contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North