Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - arecstring() return database record contents http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 arecstring()        Return database record contents
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   proc arecstring extern
   param value ptr(char) pDest, ;
               alias     sDatabase, ;
         value uint      uLength

 Arguments
   pDest is the buffer where record data are placed.
   sDatabase is the database alias to retrieve records from.
   uLength is the number of characters to copy.

 Return
   None.

 Description
   The arecstring() procedure retrieves the contents of database records.
   Records are copied into the destination buffer as they occur in the
   database (including the deleted flag), until the given copy length is
   reached.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   proc Test_arecstring
   vardef
      char        cRecord     // string to store record
      ptr( char ) pDest       // buffer pointer to store record data
   enddef
   open sTest
   arecstring( &cRecord, sTest, arecsize( sTest ) ) // read one record to char
   ? cRecord
   pDest := malloc( 1024 )                       // allocate buffer
   arecstring( pDest, sTest, arecsize( sTest ) ) // read one record to buffer
   ? *pDest                                      // display with deleted flag
   pDest++                                       // point behind deleted flag
   ? *pDest                                   // display without deleted flag
   ? "Second field contains:", ;    // display contents of second field
      substr( cRecord, afieldlen( sTest, 1 ) + 2, afieldlen( sTest, 2 ) )
   wait
   arecstring( pDest, sTest, arecsize( sTest ) * 10 ) // read in 10 records
   ? *pDest              // display all 10 records as one string
   close all
   free( pDest )         // free buffer
   endproc

   proc main
   Test_arecstring()
   endproc

See Also: afieldstring()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson