touch.c

v22.2b14/Win32/touch.c · 360 B

From the archive beta.tar.gz

Download the archive   « Back to the archive contents

#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/utime.h>

int main(int argc, char *argv[]) {
	int i, handle;

	for (i = 1; i <= argc; i++) {
		if (access(argv[i], 0) == -1) {
			handle = open(argv[i], _O_RDWR | _O_CREAT, _S_IREAD | _S_IWRITE);
			close(handle);
		} else {
			utime(argv[i], NULL);
		}
	}
	return 0;
}

Site Stats

Snippets: 1791
Codebases: 571