NCEPLIBS-bacio
2.6.0
|
Fortran-callable C functions that read and write characther data. More...
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "clib.h"
Go to the source code of this file.
Functions | |
int | baciol (int mode, long int start, int size, long int no, long int *nactual, int *fdes, const char *fname, void *datary) |
Do a bacio operation. More... | |
Fortran-callable C functions that read and write characther data.
Definition in file bacio.c.
int baciol | ( | int | mode, |
long int | start, | ||
int | size, | ||
long int | no, | ||
long int * | nactual, | ||
int * | fdes, | ||
const char * | fname, | ||
void * | datary | ||
) |
Do a bacio operation.
Available operations include:
This function is called from the Fortran code in baciof.f90.
mode | Specifies operations to be performed. See the clib.inc file for the values. Mode is obtained by adding together the values corresponding to the operations The best method is to include the clib.inc file and refer to the names for the operations rather than rely on hard-coded values. |
start | Byte number to start your operation from. 0 is the first byte in the file, not 1. |
size | The size of the objects you are trying to read or write (i.e. the size of one element of the type - 4 for integers, for example.) |
no | The number of elements to read or write (characters, integers, whatever). |
nactual | A pointer that gets the number of elements actually read or written. If the read/write operation succeeded, this will equal the value of parameter no. |
fdes | Pointer that gets an integer file id. This is not a Fortran Unit Number You can use it, however, to refer to files you've previously opened. |
fname | is the name of the file. This only needs to be defined when you are opening a file. It must be (on the Fortran side) declared as CHARACTER*N, where N is a length greater than or equal to the length of the file name. |
datary | is the name of the entity (variable, vector, array) that you want to write data out from or read it in to. The fact that C is declaring it to be a char * does not affect your fortran. |
< Open file read only.
< Open or create file for Write only.
< Open or create a file for write only, truncating existing contents.
< Open or create a file for write only append.
< Tried to open read only and write only.
< Read from an open file.
< Write to an open file.
< Tried to read and write in the same call.
< Open file read only.
< Open or create file for Write only.
< Open or create a file for write only, truncating existing contents.
< Open or create a file for write only append.
< Open or create file for read/write.
< Failure in opening file.
< Read from an open file.
< Open or create file for Write only.
< Open or create a file for write only, truncating existing contents.
< Open or create a file for write only append.
< Tried to read on a write-only file.
< Read from an open file.
< No seek ignore start parameter and do not call lseek().
< Failed in read to find the 'start' location.
< Data pointer is NULL.
< Write to an open file.
< Open file read only.
< Tried to write to a read only file.
< Write to an open file.
< No seek ignore start parameter and do not call lseek().
< Failed in write to find the 'start' location.
< Data pointer is NULL.
< Close an open file.
< Error in close.
< Read from an open file.
< Write to an open file.
< Read or wrote fewer data than requested.
< No error.
Definition at line 71 of file bacio.c.
References BA_ECLOSE, BA_EDATANULL, BA_EFEWDATA, BA_EFILEOPEN, BA_ERANDW, BA_ERNOSTART, BA_EROANDWO, BA_ERONWO, BA_EWANDRO, BA_EWNOSTART, BA_NOERROR, BACLOSE, BAOPEN_RONLY, BAOPEN_RW, BAOPEN_WONLY, BAOPEN_WONLY_APPEND, BAOPEN_WONLY_TRUNC, BAREAD, BAWRITE, and NOSEEK.