FILENAME MAX The maximum length which a filename can have if there is a limit

Filename max the maximum length which a filename can

This preview shows page 282 - 285 out of 359 pages.

FILENAME MAX The maximum length which a filename can have, if there is a limit, or otherwise the recommended size of an array intended to hold a file name. FOPEN MAX The minimum number of files that the implementation guarantees may be held open concurrently; at least eight are guaranteed. Note that three predefined streams exist and may need to be closed if a program needs to open more than five files explicitly. L tmpnam The maximum length of the string generated by tmpnam ; an inte- gral constant expression. SEEK CUR SEEK END SEEK SET Integral constant expressions used to control the actions of fseek . TMP MAX The minimum number of unique filenames generated by tmpnam ; an integral constant expression with a value of at least 25. stdin stdout stderr Predefined objects of type ( FILE * ) referring to the standard input, output and error streams respectively. These streams are automatically open when a program starts execution.
Image of page 282
274 CHAPTER 9. LIBRARIES 9.10.4 Opening, closing and buffering of streams 9.10.4.1 Opening A stream is connected to a file by means of the fopen , freopen or tmpfile functions. These functions will, if successful, return a pointer to a FILE object. Three streams are available without any special action; they are normally all connected to the physical device associated with the executing program: usu- ally your terminal. They are referred to by the names stdin , the standard input , stdout , the standard output , and stderr , the standard error streams. Normal keyboard input is from stdin , normal terminal output is to stdout , and error messages are directed to stderr . The separation of error messages from normal output messages allows the stdout stream to be connected to something other than the terminal device, and still to have error messages appear on the screen in front of you, rather than to be redirected to this file. These files are only fully buffered if they do not refer to interactive devices. As mentioned earlier, the file position indicator may or may not be movable, depending on the underlying device. It is not possible, for example, to move the file position indicator on stdin if that is connected to a terminal, as it usually is. All non-temporary files must have a filename , which is a string. The rules for what constitutes valid filenames are implementation defined. Whether a file can be simultaneously open multiple times is also implementation defined. Opening a new file may involve creating the file. Creating an existing file causes its previous contents to be discarded. 9.10.4.2 Closing Files are closed by explicitly calling fclose , exit or by returning from main . Any buffered data is flushed. If a program stops for some other reason, the status of files which it had open is undefined. 9.10.4.3 Buffering There are three types of buffering: Unbuffered Minimum internal storage is used by stdio in an attempt to send or receive data as soon as possible.
Image of page 283
9.10. INPUT AND OUTPUT 275 Line buffered Characters are processed on a line-by-line basis. This is
Image of page 284
Image of page 285

You've reached the end of your free preview.

Want to read all 359 pages?

  • Fall '08
  • Staff
  • Standard, library functions

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes