- /*
 - * wincreatetempfile1.c - Cygwin FILE_ATTRIBUTE_TEMPORARY test
 - *
 - * Usage:
 - * $ gcc -Wall wincreatetempfile1.c -o wincreatetempfile1
 - * $ rm -f xxx ; ./wincreatetempfile1 xxx yyy zzz 000 111 ; cat -n xxx
 - * ./wincreatetempfile1: h=0x0x150
 - * ./wincreatetempfile1: fd 3
 - * 1 yyyzzz000111
 - *
 - * Written by Roland Mainz <roland.mainz@nrubsig.org>
 - */
 - #include <windows.h>
 - #include <stdio.h>
 - #include <fcntl.h>
 - #include <unistd.h>
 - #include <sys/cygwin.h>
 - int main(int ac, char *av[])
 - {
 - HANDLE h = CreateFile(
 - av[1],
 - GENERIC_READ | GENERIC_WRITE,
 - 0,
 - NULL,
 - CREATE_NEW,
 - FILE_ATTRIBUTE_TEMPORARY,
 - NULL);
 - if (h == INVALID_HANDLE_VALUE) {
 - DWORD err = GetLastError();
 - return 1;
 - }
 - int fd = cygwin_attach_handle_to_fd(av[1], -1, h, 1, O_RDWR);
 - for(int i = 2 ; i < ac ; i++) {
 - }
 - (void)close(fd);
 - return 0;
 - }
 
wincreatetempfile1.c - Cygwin FILE_ATTRIBUTE_TEMPORARY test
Posted by Anonymous on Wed 17th Apr 2024 00:52
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
 nrubsig.kpaste.net RSS