libmaketmpfile man page on YellowDog

Man page or keyword search:  
man Server   18644 pages
apropos Keyword Search (all sections)
Output format
YellowDog logo
[printable version]

Netpbm subroutine librNetpbmmsubroutineilibrary:cpm_make_tmpfile() function(3)

NAME
       pm_make_tmpfile() - create a temporary named file

SYNOPSIS
       #include <netpbm/pm.h>

       pm_make_tmpfile(FILE **	     fileP,
		       const char ** filenameP);

EXAMPLE
       This  simple  example creates a temporary file, writes 'hello world' to
       it, then writes some search patterns to it, then uses it	 as  input  to
       grep:

       #include <netpbm/pm.h>

       FILE * myfileP;
       const char * myfilename;

       pm_make_tmpfile(&myfileP, &myfilename);

       fprintf(myfile, '^account:\s.*0);
       fprintf(myfile, '^name:\s.*0);

       fclose(myFileP);

       asprintfN(&grepCommand, 'grep --file='%s' /tmp/infile >/tmp/outfile');

       system(grepCommand);

       strfree(grepCommand);

       unlink(myfilename);

       strfree(myfilename);

DESCRIPTION
       This library function is part of Netpbm(1).

       pm_make_tmpfile()  creates and opens a temporary file, returning to you
       a stream file handle for it and its name.

       pm_make_tmpfile() chooses a file name that is not already in use,  with
       proper  interlocking  to	 make sure that it actually creates a file and
       opens the new file, as opposed to merely opening an existing file.

       If you don't need to access the file by name, use pm_tmpfile() instead,
       because	it's  cleaner.	With pm_tmpfile(), the operating system always
       deletes the temporary file when your  program  exits,  if  the  program
       failed to clean up after itself.

       The  temporary file goes in the directory named by the TMPFILE environā€
       ment variable.  If TMPFILE is not set or is set to  something  unusable
       (e.g.   too long), pm_tmpfile() falls back to the value of the standard
       C library symbol P_tmpdir (like the standard C library's tmpfile()).

       The name of the file within that directory is like myprog_blrfx,	 where
       myprog is the name of your program (arg 0) and the rest is an arbitrary
       discriminator.

       If pm_make_tmpfile() is unable to create a temporary file, it issues  a
       message to Standard Error and aborts the program.

HISTORY
       pm_tmpfile() was introduced in Netpbm 10.27 (March 2005).

netpbm documentation  Netpbm subroutineblibrary: pm_make_tmpfile() function(3)
[top]

List of man pages available for YellowDog

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net