次の方法で共有


_DBRewind( ) API Library Routine

Works like the Visual FoxPro GO TOP command in the specified work area, and then returns the current record number.

long _DBRewind(int workarea)
int workarea;               /* Work area. */

Example

The following example calls _DBRewind( ) for the table open in the current work area. This has the same effect as the Visual FoxPro GO TOP command.

Visual FoxPro Code

SET LIBRARY TO DBREWIND
DO CreateTest
GO BOTTOM
? RECNO()
? DBREWIND()    && returns 1
? RECNO()  && yes, we're at record 1

PROCEDURE CreateTest
   CREATE TABLE test (ABC C(20))
   APPEND BLANK
   REPLACE ABC WITH "This is record 1"
   APPEND BLANK
   REPLACE ABC WITH "This is record 2"
   APPEND BLANK
   REPLACE ABC WITH "This is record 3"
   APPEND BLANK
   REPLACE ABC WITH "This is record 4"
   GO TOP
RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
{
   _RetInt(_DBRewind(-1), 10);
}
FoxInfo myFoxInfo[] = {
   {"DBREWIND", (FPFI) Example, 0, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

Concepts

API Library Routines A-Z

Reference

_DBSkip( ) API Library Routine

_DBUnwind( ) API Library Routine

GO | GOTO Command

Other Resources

Accessing the Visual FoxPro API

API Library Routines by Category