Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

libmaketmpfilefd(3) [centos man page]

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

NAME
pm_make_tmpfile_fd() - create a temporary named file SYNOPSIS
#include <netpbm/pm.h> pm_make_tmpfile(int * fdP, 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> int fd; const char * myfilename; pm_make_tmpfile_fd(&fdP, &myfilename); write(fd, '^account:\s.* ', 16); fprintf(fd, '^name:\s.* ', 13); close(fd); 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_fd() is analogous to pm_make_tmpfile()(1) difference is that it opens the file as a low level file, as open() would, rather than as a stream, as fopen() would. If you don't need to access the file by name, use pm_tmpfile_fd() instead, because it's cleaner. With pm_tmpfile_fd(), the operating sys- tem always deletes the temporary file when your program exits, if the program failed to clean up after itself. HISTORY
pm_tmpfile() was introduced in Netpbm 10.42 (March 2008). netpbm documentation 31 December 2007 Netpbm subroutine library: pm_make_tmpfile_fd() function(3)

Check Out this Related 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 world0); fseek(myfileP, 0, SEEK_SET); fread(buffer, sizeof(buffer), 1, myfileP); fprintf(STDOUT, 'temp file contains '%s'0, 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)
Man Page

We Also Found This Discussion For You

1. Shell Programming and Scripting

variable assignment using awk

Guys, Could you please help me out. I need two values in two variables using awk from the o/p of grep. example:- grep sdosanjh <filename> sdosanjh myhostname myfilename NOW WHAT I WANT IS :- sdosanjh should be in variable (say NAME) myhostname should be in variable (say... (8 Replies)
Discussion started by: sdosanjh
8 Replies