Macros | Functions
interfile.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BACKUP_EXTENSION   ".bak"
 

Functions

int interfile_read (char headerName[256], char searchWord[256], char returnValue[256], char errorMessage[300])
 

Macro Definition Documentation

#define BACKUP_EXTENSION   ".bak"

Definition at line 16 of file interfile.h.

Function Documentation

int interfile_read ( char  headerName[256],
char  searchWord[256],
char  returnValue[256],
char  errorMessage[300] 
)

The function searches the keyword in the header and passes the value belonging to that value back to the main program. The name of the header (string 'headerName') and the requested keyword (string 'searchWord') are passed to the function. It passes back the value of the keyword (string 'returnValue') and possibly an error message or warning (string 'errorMessage'). So the values are passed back as strings. The interpretation (conversion to integer, float, time etc) is up to the programmer.

The interfile header has to comply to the following rules:

  • first line in the file is '!INTERFILE'
  • maximal length of a line is 512 characters
  • A line has two fields sperated by ':=' (keyword := value)
  • maximal length of keyword and value is 256 characters.
  • no header entries after a line '!END OF INTERFILE'
  • a line starting with a semicolon ';' is a comment
Parameters
headerNameheader file name
searchWordkeyword to look for
returnValuevalue for keyword in header
errorMessageerror message/warnings. In case there is a error message it will be returnd as string in the variable 'errmsg'.
Returns
0 if ok, 1 keyword appears more than once in the interfile header (value of last occurence of keyword is returned), 2 keyword not found in interfile header (returned value is empty (i.e. contains '/0's only)), 3 interfile header cold not be opened for reading (returned value is empty (i.e. contains '/0's only)), 4 wrong file format?! (No '!INTERFILE' in the first line) (returned value is empty (i.e. contains '/0's only))

Definition at line 70 of file interfile.c.