Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
openFile.h
Go to the documentation of this file.
1#pragma once
2
3#include <cgraph/exit.h>
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.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:149
static FILE * openFile(const char *argv0, const char *name, const char *mode)
Definition openFile.h:8