Skip to content

Instantly share code, notes, and snippets.

@vadv
Created June 3, 2016 15:17
Show Gist options
  • Save vadv/37cb2147255577856a75b27a95ad1ee0 to your computer and use it in GitHub Desktop.
Save vadv/37cb2147255577856a75b27a95ad1ee0 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
int main (void)
{
char fn[100];
int f;
char basedir[] = "f:\\data\\";
char current_walfile_name[] = "pg_xlog/fooo";
snprintf(fn, sizeof(fn), "%s/%s", basedir, current_walfile_name);
printf("fn: %s\n", fn);
f = open(fn, O_WRONLY);
if (f == -1) {
fprintf(stderr,("could not open transaction log file \"%s\": %s\n"), fn, strerror(errno));
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment