ewmscp  ..
Functions
tmpTest.cpp File Reference

(v0.19-24-g0617ca1 with changes)

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
Include dependency graph for tmpTest.cpp:

Go to the source code of this file.

Functions

int main (int argc, const char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
const char *  argv[] 
)

Definition at line 9 of file tmpTest.cpp.

9  {
10  auto fd = open(argv[1], O_TMPFILE | O_WRONLY, 0777);
11  write(fd, argv[1], strlen(argv[1]));
12  write(fd, argv[2], strlen(argv[2]));
13  char path[1024];
14  snprintf(path, 1024, "/proc/self/fd/%d", fd);
15  linkat(df, "", AT_FDCWD, argv[2], AT_EMPTY_PATH);
16  close(fd);
17 }