Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

libtmpfile(3) [centos man page]

Netpbm subroutine library: pm_tmpfile() function(3)	     Library Functions Manual	       Netpbm subroutine library: pm_tmpfile() function(3)

NAME
pm_tmpfile() - create a temporary unnamed file SYNOPSIS
#include <netpbm/pm.h> FILE * pm_tmpfile(void); EXAMPLE
This simple example creates a temporary file, writes 'hello world' to it, then reads back and prints those contents. #include <netpbm/pm.h> FILE * myfileP; myfile = pm_tmpfile(); fprintf(myfile, 'hello world '); fseek(myfileP, 0, SEEK_SET); fread(buffer, sizeof(buffer), 1, myfileP); fprintf(STDOUT, 'temp file contains '%s' ', buffer); fclose(myfileP); DESCRIPTION
This library function is part of Netpbm(1) pm_tmpfile() creates and opens an unnamed temporary file. It is basically the same thing as the standard C library tmpfile() function, except that it uses the TMPFILE environment variable to decide where to create the temporary file. 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, just like tmpfile(). Unlike tmpfile(), pm_tmpfile() never returns NULL. If it fails, it issues a message to Standard Error and aborts the program, like most libnetpbm routines do. If you need to refer to the temporary file by name, use pm_make_tmpfile() instead. HISTORY
pm_tmpfile() was introduced in Netpbm 10.20 (January 2004). netpbm documentation 22 July 2004 Netpbm subroutine library: pm_tmpfile() function(3)

Check Out this Related Man Page

TMPFILE(3)								 1								TMPFILE(3)

tmpfile - Creates a temporary file

SYNOPSIS
resource tmpfile (void ) DESCRIPTION
Creates a temporary file with a unique name in read-write (w+) mode and returns a file handle . The file is automatically removed when closed (for example, by calling fclose(3), or when there are no remaining references to the file handle returned by tmpfile(3)), or when the script ends. For details, consult your system documentation on the tmpfile(3) function, as well as the stdio.h header file. RETURN VALUES
Returns a file handle, similar to the one returned by fopen(3), for the new file or FALSE on failure. EXAMPLES
Example #1 tmpfile(3) example <?php $temp = tmpfile(); fwrite($temp, "writing to tempfile"); fseek($temp, 0); echo fread($temp, 1024); fclose($temp); // this removes the file ?> The above example will output: writing to tempfile SEE ALSO
tempnam(3), sys_get_temp_dir(3). PHP Documentation Group TMPFILE(3)
Man Page

2 More Discussions You Might Find Interesting

1. Solaris

No space left on device

We are using this function tmpfile() : FILE *tmpfp ; if ((tmpfp = tmpfile()) == NULL) { fprintf(stderr, "%s: ERROR: init_operator(): ", ROUTINE); perror("tmpfile()"); exit(ERR_OPEN); } and the above is raising error : MSMD0603: ERROR:... (3 Replies)
Discussion started by: atiato
3 Replies

2. Programming

help with fseek

Hi, I working a c project in IBM AIX. I have a requirement like this. I have some contents in *temp. I am writing the contents of *temp to a file pointer ftemp (*ftemp for an tmp file tmpfile.txt) Now I want to read the contents of *ftemp in the reverse order an dneed to print it in the... (2 Replies)
Discussion started by: ramkrix
2 Replies