Node:String output and input, Next:, Previous:High-level file routines, Up:Input and output

String output and input

We will now examine some high-level file functions for reading strings from and writing strings to streams. The two string output methods we will examine (puts and fputs) are very safe to use, but the input methods run from the antiquated and very dangerous gets to the safer fgets, to getline and getdelim, two GNU-specific extensions to the C language that are extremely safe to use.

It is important to use the safer and better GNU functions when you can. However, you will probably still want to learn how to read and understand older (but still free) code that is unsafe (perhaps to update it and make it safe), so this book describes functions like gets despite the fact that they are unsafe.