Japanese
PROGRAMMER'S GUIDEFile system library
BackForward
file system library

8.Function specification-2


8.2 File operations


 one
View
table
 Title

function specification

 Function

Open file

 Function name

GFS_Open

 No

2.1

Format
GfsHn GFS_Open(Sint32 fid)
input
fid: file identifier
output
none
function value
file handle. Returns NULL in case of error.
function
Opens the specified file and returns a file handle.

 one
View
table
 Title

function specification

 Function

Close file

 Function name

GFS_Close

 No

2.2

Format
void GFS_Close(GfsHn gfs)
input
gfs: file handle
output
none
function value
none
function
Closes the specified file handle.

 one
View
table
 Title

function specification

 Function

Moving the access point

 Function name

GFS_Seek

 No

2.3

Format
Sint32 GFS_Seek(GfsHn gfs, Sint32 off, Sint32 org)
input
 gfs
 : file handle
 off
 :Amount of access pointer movement (in sector units)
 org
 : Movement criteria (seek mode: GFS_SEEK_~)
output
none
function value
The position of the access pointer after the move. A negative error code if there was an error.
function
Move the access pointer off sector away from org.
Access pointers cannot be specified outside the scope of the file.

 one
View
table
 Title

function specification

 Function

Get access pointer

 Function name

GFS_Tell

 No

2.4

Format
Sint32 GFS_Tell(GfsHn gfs)
input
gfs: file handle
output
none
function value
Location of access pointer. Negative error code in case of error.
function
Get the location of the access pointer.

 one
View
table
 Title

function specification

 Function

Check for end of file

 Function name

GFS_IsEof

 No

2.5

Format
Bool GFS_IsEof(GfsHn gfs)
input
gfs: file handle
output
none
function value
End of file flag.
function
Checks whether the access pointer has reached the end of the file. Function values have the following meanings:
 TRUE
 : The end of the file has been reached.
 FALSE
 : The end of the file has not been reached.
If an invalid file handle is input, it is assumed that the end of the file has been reached.

 one
View
table
 Title

function specification

 Function

Conversion from byte size to sector length

 Function name

GFS_ByteToSct

 No

2.6

Format
Sint32 GFS_ByteToSct(GfsHn gfs, Sint32 nbyte)
input
 gfs
 : file handle
 nbyte
 : Number of bytes
output
none
function value
Number of sectors. Negative error code in case of error.
function
Converts units from bytes to sectors (nsct). The length in sectors, nsct, is calculated using the following formula.

nsct = (nbyte + file sector length - 1) / file sector length;

If the sector length is undefined (Form1 and Form2 are mixed), 0 is the function value.

 one
View
table
 Title

function specification

 Function

Get file size

 Function name

GFS_GetFileSize

 No

2.7

Format
void GFS_GetFileSize(GfsHn gfs, Sint32 *sctsize, Sint32 *nsct,Sint32 *lastsize)
input
gfs: file handle
output
 sctsize
 :Sector length
 nsct
 : Number of sectors (including the last sector)
 last size
 :Number of bytes occupied by file data in the last sector
function value
none
function
Gets information for determining the file size. By specifying NULL for sctsize, nsct, and lastsize, you can suppress the output of that information. The file size (fsize) can be calculated using the following formula.
fsize=sctsize*(nsct−1)+lastsize;
remarks
In a file containing both Form1 and Form2, both sctsize and lastsize will be 0.

 one
View
table
 Title

function specification

 Function

Get file information

 Function name

GFS_GetFileInfo

 No

2.8

Format
void GFS_GetFileInfo(GfsHn gfs, Sint32 *fid, Sint32 *fn, Sint32 *fsize,Sint32 *atr)
input
gfs: file handle
output
 fid
 :File identifier
 fn
 :File number
 fsize
 : File size (unit: bytes)
 atr
 :File attributes
function value
none
function
Get file information. By specifying NULL for fid, fn, fsize, and atr, you can suppress the output of that information. The file size is the value recorded in the directory information, so the size of 1 sector is calculated as 2048 bytes.

 one
View
table
 Title

function specification

 Function

Obtaining the number of sectors in the CD buffer partition

 Function name

GFS_GetNumCdbuf

 No

2.9

Format
Sint32 GFS_GetNumCdbuf(GfsHn gfs)
input
gfs: file handle
output
none
function value
Number of sectors in CD buffer partition
function
Gets the number of sectors present in the CD buffer partition.

BackForward
PROGRAMMER'S GUIDEFile system library
Copyright SEGA ENTERPRISES, LTD., 1997