Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
openFile.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6#include <util/exit.h>
7
8static inline FILE *openFile(const char *argv0, const char *name,
9 const char *mode) {
10 FILE *fp = fopen(name, mode);
11 if (fp == NULL) {
12 const char *modestr = strcmp(mode, "r") == 0 ? "reading" : "writing";
13 fprintf(stderr, "%s: could not open file %s for %s\n", argv0, name,
14 modestr);
15 perror(name);
16 graphviz_exit(EXIT_FAILURE);
17 }
18 return fp;
19}
mode
Definition cvtgxl.c:33
static NORETURN void graphviz_exit(int status)
Definition exit.h:23
node NULL
Definition grammar.y:163
static FILE * openFile(const char *argv0, const char *name, const char *mode)
Definition openFile.h:8