xref: /phasta/phSolver/common/phio_stream.cc (revision ecf8d2a957efd836543027ab6bc915054d1d1142)
1 #include "phio_stream.h"
2 void stream_openfile(
3     const char filename[],
4     phio_fp f) {
5   stream_fp sf = (stream_fp) f;
6   if(sf->mode == 'w' && sf->rs != NULL)
7     sf->file = (int*) openRStreamWrite(sf->rs);
8   else if(sf->mode == 'r' && sf->grs != NULL)
9     sf->file = (int*) openGRStreamRead(sf->grs, filename);
10   else
11     fprintf(stderr,
12         "ERROR %s type of stream %s is unknown... exiting\n",
13         __func__, filename);
14 }
15 
16 void stream_closefile(phio_fp f) {
17   stream_fp sf = (stream_fp) f;
18   fclose((FILE*)sf->file);
19 }
20 
21 void stream_constructname(const char* in, char* out) {
22   sprintf(out, "%s", in);
23 }
24 
25