File: ibuf_openreadclose.c

package info (click to toggle)
bglibs 2.04%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,468 kB
  • sloc: ansic: 15,821; perl: 674; sh: 63; makefile: 29
file content (14 lines) | stat: -rw-r--r-- 289 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "iobuf.h"
#include "str.h"

/** Open and read the entire file into the \c str . */
int ibuf_openreadclose(const char* filename, struct str* out)
{
  ibuf in;
  int r;
  if (!ibuf_open(&in, filename, 0))
    return 0;
  r = ibuf_readall(&in, out);
  ibuf_close(&in);
  return r;
}