libmsx
C library for MSX
Loading...
Searching...
No Matches
Get / Set the current position of the stream.

Get / Set the current position of the stream. More...

+ Collaboration diagram for Get / Set the current position of the stream.:

Macros

#define MEM_SEEK_SET   (0)
 A constant to specify that the offset is relative to the start of the stream.
 
#define MEM_SEEK_CUR   (1)
 A constant to specify that the offset is relative to the current position indicator.
 
#define MEM_SEEK_END   (2)
 A constant to specify that the offset is relative to the end of the stream.
 

Typedefs

typedef struct MemPos mempos_t
 Stream position indicator.
 

Functions

void mfseek (MemFile *mf, long offset, int whence)
 Set the stream position indicator for the stream pointed by mf.
 
void mfgetpos (MemFile *mf, mempos_t *pos)
 Get the stream position indicator of the stream pointed by mf.
 
void mfsetpos (MemFile *mf, const mempos_t *pos)
 Set the stream position indicator of the stream pointed by mf.
 
void mfsetpos2 (MemFile *mf, const mempos_t *base, long offset)
 Set the stream position indicator of the stream pointed by mf.
 

Detailed Description

Get / Set the current position of the stream.

Macro Definition Documentation

◆ MEM_SEEK_SET

#define MEM_SEEK_SET   (0)

A constant to specify that the offset is relative to the start of the stream.

See also
mfseek()

Definition at line 59 of file memfile.h.

◆ MEM_SEEK_CUR

#define MEM_SEEK_CUR   (1)

A constant to specify that the offset is relative to the current position indicator.

See also
mfseek()

Definition at line 66 of file memfile.h.

◆ MEM_SEEK_END

#define MEM_SEEK_END   (2)

A constant to specify that the offset is relative to the end of the stream.

See also
mfseek()

Definition at line 73 of file memfile.h.

Typedef Documentation

◆ mempos_t

typedef struct MemPos mempos_t

Stream position indicator.

Note
Corresponds to fpos_t type of the standard C library I/O stream.

Definition at line 80 of file memfile.h.

Function Documentation

◆ mfseek()

void mfseek ( MemFile mf,
long  offset,
int  whence 
)

Set the stream position indicator for the stream pointed by mf.

Parameters
mfPointer to opened stream pointer.
offsetOffset in bytes from the position specified by whence.
whenceSpecify the base position of offset.
  • MEM_SEEK_SET specifies that the offset is relative to the start of the stream,
  • MEM_SEEK_CUR specifies that the offset is relative to the current position indicator.
  • MEM_SEEK_END specifies that the offset is relative to the end of the stream.

◆ mfgetpos()

void mfgetpos ( MemFile mf,
mempos_t pos 
)

Get the stream position indicator of the stream pointed by mf.

Parameters
mfPointer to opened stream pointer.
posPointer to the buffer where the stream position indicator will be stored.

◆ mfsetpos()

void mfsetpos ( MemFile mf,
const mempos_t pos 
)

Set the stream position indicator of the stream pointed by mf.

Parameters
mfPointer to opened stream pointer.
posPointer to the stream position indicator retrieved by mfgetpos().

◆ mfsetpos2()

void mfsetpos2 ( MemFile mf,
const mempos_t base,
long  offset 
)

Set the stream position indicator of the stream pointed by mf.

Parameters
mfPointer to opened stream pointer.
basePointer to the stream position indicator retrieved by mfgetpos().
offsetOffset from the base.