Action:
|
Reads a string into a supplied buffer of a given size,
maxlen.
|
|
Prototype:
|
char* read_string (
|
|
|
int& len
|
// length of buffer
|
|
|
);
|
|
|
int read_string (
|
|
|
char* buf
|
// character string
|
|
|
);
|
|
Includes:
|
#include "kernel/acis.hxx"
|
|
#include "kernel/kernutil/fileio/fileio.hxx"
|
|
Description:
|
This routine is used as part of restore from a SAT or SAB file. Reads a string. This consists of an integer length, followed by that number of literal characters. In text mode, the length and characters are separated by exactly one space. In
int read_string, we assume that the buffer supplied is of sufficient length for the characters plus the usual terminating null. The function returns the actual number of characters read. The
char* read_string is a more convenient form of
read_string. The string is written the same as it was for the old version, with a count followed by the actual string. Unlike the old version however, this version allocates a string of the correct length and returns a pointer to it, so you do not have to worry about reading the count, and then backspacing the file to re-read the string if you want to make sure that you have a buffer which is big enough. If the length of the string was zero characters, then this will return
NULL rather than "".
ActiveFile is a
FileInterface object and does most of the actual work.
|
|
|
return ActiveFile ? ActiveFile->read_string(buf) : 0;
|
|
Call the appropriate SatFile or SabFile method
|
|
|
return ActiveFile ? ActiveFile->read_string(len) : NULL;
|
|
Call the appropriate SatFile or SabFile method
|
|
Library:
|
kernel
|
|
Filename:
|
kern/kernel/kernutil/fileio/fileio.hxx
|
|
Effect:
|
Read-only
|