Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
14
Task/Secure-temporary-file/C/secure-temporary-file-1.c
Normal file
14
Task/Secure-temporary-file/C/secure-temporary-file-1.c
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
FILE *fh = tmpfile(); /* file is automatically deleted when program exits */
|
||||
/* do stuff with stream "fh" */
|
||||
fclose(fh);
|
||||
/* The C standard library also has a tmpnam() function to create a file
|
||||
for you to open later. But you should not use it because someone else might
|
||||
be able to open the file from the time it is created by this function to the
|
||||
time you open it. */
|
||||
return 0;
|
||||
}
|
||||
12
Task/Secure-temporary-file/C/secure-temporary-file-2.c
Normal file
12
Task/Secure-temporary-file/C/secure-temporary-file-2.c
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char filename[] = "/tmp/prefixXXXXXX";
|
||||
int fd = mkstemp(filename);
|
||||
puts(filename);
|
||||
/* do stuff with file descriptor "fd" */
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue