SA_TxtRead


 

SA_TxtRead searches for a text record matching the conditions specified in the method and read that record.

int SA_TxtRead ( SA_FH TxtFH, u8 *Buffer, u32 BufLen, u32 Method );

or

int SA_TxtRead32 ( SA_FH TxtFH, u8 *Buffer, u32 BufLen, u32 Method );

Parameters:
TxtFH
The handle of the previously opened or prepared text file.
Buffer
The buffer filled by the operation.
BufLen
The length of the {Buffer}.
Method
An access parameter as described below that locates the record.

Note the following:

  1. {Buffer} size must be equal to or larger than the {reclen} parameter specified in SA_IsiPrep plus one (1) for null termination.

  2. {Method} may be one of the following access values:

  3.  

    Value

    Meaning

    -1

    Sequential read.

    -3

    End of file.

    -4

    Sequential prior.

    nn

    Random based on record size.

     

  4. Function return codes are as follows:

  5.  

    Value

    Meaning

    nn

    Number of bytes read + 1.

    0

    No record found.

    -nn

    Error as described in Sunaccess Errors

     

  6. Use SA_TxtRead32 for 32 bit applications such as Visual Basic 6.0.

Examples:

 

long fh;

char buffer[2048];

 

SA_TxtRead(fh, buffer, sizeof(buffer), -1); // next record

SA_TxtRead(fh, buffer, sizeof(buffer), 42); // record 42

SA_TxtRead(fh, buffer, sizeof(buffer), -3); // end of file

SA_TxtRead(fh, buffer, sizeof(buffer), -4); // previous record

 

 



Sunaccess Reference SA_TxtClose SA_TxtWrite