vitasdk
Documentation of the vitasdk

Detailed Description

Exports for User


Using this library in your project

Include the header file in your project:

#include <psp2/io/fcntl.h>


Link the library to the executable:

SceIofilemgr_stub



Functions

SceUID sceIoOpen (const char *file, int flags, SceMode mode)
 Open or create a file for reading or writing. More...
 
SceUID sceIoOpenAsync (const char *file, int flags, SceMode mode)
 Open or create a file for reading or writing (asynchronous) More...
 
int sceIoClose (SceUID fd)
 Delete a descriptor. More...
 
int sceIoCloseAsync (SceUID fd)
 Delete a descriptor (asynchronous) More...
 
int sceIoRead (SceUID fd, void *data, SceSize size)
 Read input. More...
 
int sceIoReadAsync (SceUID fd, void *data, SceSize size)
 Read input (asynchronous) More...
 
int sceIoPread (SceUID fd, void *data, SceSize size, SceOff offset)
 Read input at offset. More...
 
int sceIoWrite (SceUID fd, const void *data, SceSize size)
 Write output. More...
 
int sceIoWriteAsync (SceUID fd, const void *data, SceSize size)
 Write output (asynchronous) More...
 
int sceIoPwrite (SceUID fd, const void *data, SceSize size, SceOff offset)
 Write output at offset. More...
 
SceOff sceIoLseek (SceUID fd, SceOff offset, int whence)
 Reposition read/write file descriptor offset. More...
 
int sceIoLseekAsync (SceUID fd, SceOff offset, int whence)
 Reposition read/write file descriptor offset (asynchronous) More...
 
int sceIoLseek32 (SceUID fd, int offset, int whence)
 Reposition read/write file descriptor offset (32bit mode) More...
 
int sceIoRemove (const char *file)
 Remove directory entry. More...
 
int sceIoRename (const char *oldname, const char *newname)
 Change the name of a file. More...
 
int sceIoSync (const char *device, unsigned int unk)
 Synchronize the file data on the device. More...
 
int sceIoSyncByFd (SceUID fd)
 Synchronize the file data for one file. More...
 
int sceIoCancel (SceUID fd)
 Cancel an asynchronous operation on a file descriptor. More...
 

Enumeration Type Documentation

◆ SceIoMode

enum SceIoMode
Enumerator
SCE_O_RDONLY 

Read-only.

SCE_O_WRONLY 

Write-only.

SCE_O_RDWR 

Read/Write.

SCE_O_NBLOCK 

Non blocking.

SCE_O_DIROPEN 

Internal use for sceIoDopen.

SCE_O_RDLOCK 

Read locked (non-shared)

SCE_O_WRLOCK 

Write locked (non-shared)

SCE_O_APPEND 

Append.

SCE_O_CREAT 

Create.

SCE_O_TRUNC 

Truncate.

SCE_O_EXCL 

Exclusive create.

SCE_O_SCAN 

Scan type.

SCE_O_RCOM 

Remote command entry.

SCE_O_NOBUF 

Number device buffer.

SCE_O_NOWAIT 

Asynchronous I/O.

SCE_O_FDEXCL 

Exclusive access.

SCE_O_PWLOCK 

Power control lock.

SCE_O_FGAMEDATA 

Gamedata access.

SCE_O_RDONLY 

Read-only.

SCE_O_WRONLY 

Write-only.

SCE_O_RDWR 

Read/Write.

SCE_O_NBLOCK 

Non blocking.

SCE_O_DIROPEN 

Internal use for ksceIoDopen.

SCE_O_RDLOCK 

Read locked (non-shared)

SCE_O_WRLOCK 

Write locked (non-shared)

SCE_O_APPEND 

Append.

SCE_O_CREAT 

Create.

SCE_O_TRUNC 

Truncate.

SCE_O_EXCL 

Exclusive create.

SCE_O_SCAN 

Scan type.

SCE_O_RCOM 

Remote command entry.

SCE_O_NOBUF 

Number device buffer.

SCE_O_NOWAIT 

Asynchronous I/O.

SCE_O_FDEXCL 

Exclusive access.

SCE_O_PWLOCK 

Power control lock.

SCE_O_FGAMEDATA 

Gamedata access.

◆ SceIoSeekMode

Enumerator
SCE_SEEK_SET 

Starts from the begin of the file.

SCE_SEEK_CUR 

Starts from current position.

SCE_SEEK_END 

Starts from the end of the file.

SCE_SEEK_SET 

Starts from the begin of the file.

SCE_SEEK_CUR 

Starts from current position.

SCE_SEEK_END 

Starts from the end of the file.

◆ SceIoDevType

Enumerator
SCE_DEV_TYPE_NULL 

Dummy device.

SCE_DEV_TYPE_CHAR 

Character device.

SCE_DEV_TYPE_BLOCK 

Block device.

SCE_DEV_TYPE_FS 

File system device.

SCE_DEV_TYPE_ALIAS 

Alias name.

SCE_DEV_TYPE_MOUNTPT 

Mount point.

SCE_DEV_TYPE_NULL 

Dummy device.

SCE_DEV_TYPE_CHAR 

Character device.

SCE_DEV_TYPE_BLOCK 

Block device.

SCE_DEV_TYPE_FS 

File system device.

SCE_DEV_TYPE_ALIAS 

Alias name.

SCE_DEV_TYPE_MOUNTPT 

Mount point.

Function Documentation

◆ sceIoOpen()

SceUID sceIoOpen ( const char *  file,
int  flags,
SceMode  mode 
)

Open or create a file for reading or writing.

Example1: Open a file for reading
if((fd = sceIoOpen("device:/path/to/file", SCE_O_RDONLY, 0777) < 0) {
// error code in fd, for example no open filehandle left (0x80010018)
}
Example2: Open a file for writing, creating it if it doesn't exist
if((fd = sceIoOpen("device:/path/to/file", SCE_O_WRONLY|SCE_O_CREAT, 0777) < 0) {
// error code in fd, for example no open filehandle left (0x80010018)
}
Parameters
file- Pointer to a string holding the name of the file to open.
flags- Libc styled flags that are or'ed together (One or more SceIoMode).
mode- One or more SceIoAccessMode flags or'ed together. Can also use Unix absolute permissions.
Returns
> 0 is a valid file handle, < 0 on error.

◆ sceIoOpenAsync()

SceUID sceIoOpenAsync ( const char *  file,
int  flags,
SceMode  mode 
)

Open or create a file for reading or writing (asynchronous)

Parameters
file- Pointer to a string holding the name of the file to open.
flags- Libc styled flags that are or'ed together (One or more SceIoMode).
mode- One or more SceIoAccessMode flags or'ed together. Can also use Unix absolute permissions.
Returns
> 0 is a valid file handle, < 0 on error.

◆ sceIoClose()

int sceIoClose ( SceUID  fd)

Delete a descriptor.

Parameters
fd- File descriptor to close
Returns
< 0 on error

◆ sceIoCloseAsync()

int sceIoCloseAsync ( SceUID  fd)

Delete a descriptor (asynchronous)

Parameters
fd- File descriptor to close
Returns
< 0 on error

◆ sceIoRead()

int sceIoRead ( SceUID  fd,
void *  data,
SceSize  size 
)

Read input.

Example:
bytes_read = sceIoRead(fd, data, 100);
Parameters
fd- Opened file descriptor to read from
data- Pointer to the buffer where the read data will be placed
size- Size of the read in bytes
Returns
The number of bytes read

◆ sceIoReadAsync()

int sceIoReadAsync ( SceUID  fd,
void *  data,
SceSize  size 
)

Read input (asynchronous)

Example:
bytes_read = sceIoRead(fd, data, 100);
Parameters
fd- Opened file descriptor to read from
data- Pointer to the buffer where the read data will be placed
size- Size of the read in bytes
Returns
< 0 on error.

◆ sceIoPread()

int sceIoPread ( SceUID  fd,
void *  data,
SceSize  size,
SceOff  offset 
)

Read input at offset.

Example:
bytes_read = sceIoPread(fd, data, 100, 0x1000);
Parameters
fd- Opened file descriptor to read from
data- Pointer to the buffer where the read data will be placed
size- Size of the read in bytes
offset- Offset to read
Returns
< 0 on error.

◆ sceIoWrite()

int sceIoWrite ( SceUID  fd,
const void *  data,
SceSize  size 
)

Write output.

Example:
bytes_written = sceIoWrite(fd, data, 100);
Parameters
fd- Opened file descriptor to write to
data- Pointer to the data to write
size- Size of data to write
Returns
The number of bytes written

◆ sceIoWriteAsync()

int sceIoWriteAsync ( SceUID  fd,
const void *  data,
SceSize  size 
)

Write output (asynchronous)

Parameters
fd- Opened file descriptor to write to
data- Pointer to the data to write
size- Size of data to write
Returns
< 0 on error.

◆ sceIoPwrite()

int sceIoPwrite ( SceUID  fd,
const void *  data,
SceSize  size,
SceOff  offset 
)

Write output at offset.

Example:
bytes_written = sceIoPwrite(fd, data, 100, 0x1000);
Parameters
fd- Opened file descriptor to write to
data- Pointer to the data to write
size- Size of data to write
offset- Offset to write
Returns
The number of bytes written

◆ sceIoLseek()

SceOff sceIoLseek ( SceUID  fd,
SceOff  offset,
int  whence 
)

Reposition read/write file descriptor offset.

Example:
pos = sceIoLseek(fd, -10, SCE_SEEK_END);
Parameters
fd- Opened file descriptor with which to seek
offset- Relative offset from the start position given by whence
whence- One of SceIoSeekMode.
Returns
The position in the file after the seek.

◆ sceIoLseekAsync()

int sceIoLseekAsync ( SceUID  fd,
SceOff  offset,
int  whence 
)

Reposition read/write file descriptor offset (asynchronous)

Parameters
fd- Opened file descriptor with which to seek
offset- Relative offset from the start position given by whence
whence- One of SceIoSeekMode.
Returns
< 0 on error. Actual value should be passed returned by the ::sceIoWaitAsync call.

◆ sceIoLseek32()

int sceIoLseek32 ( SceUID  fd,
int  offset,
int  whence 
)

Reposition read/write file descriptor offset (32bit mode)

Example:
pos = sceIoLseek32(fd, -10, SCE_SEEK_END);
Parameters
fd- Opened file descriptor with which to seek
offset- Relative offset from the start position given by whence
whence- One of SceIoSeekMode.
Returns
The position in the file after the seek.

◆ sceIoRemove()

int sceIoRemove ( const char *  file)

Remove directory entry.

Parameters
file- Path to the file to remove
Returns
< 0 on error

◆ sceIoRename()

int sceIoRename ( const char *  oldname,
const char *  newname 
)

Change the name of a file.

Parameters
oldname- The old filename
newname- The new filename
Returns
< 0 on error.

◆ sceIoSync()

int sceIoSync ( const char *  device,
unsigned int  unk 
)

Synchronize the file data on the device.

Parameters
device- The device to synchronize (e.g. msfat0:)
unk- Unknown

◆ sceIoSyncByFd()

int sceIoSyncByFd ( SceUID  fd)

Synchronize the file data for one file.

Parameters
fd- Opened file descriptor to sync
Returns
< 0 on error.

◆ sceIoCancel()

int sceIoCancel ( SceUID  fd)

Cancel an asynchronous operation on a file descriptor.

Parameters
fd- The file descriptor to perform cancel on.
Returns
< 0 on error.
SCE_O_RDONLY
@ SCE_O_RDONLY
Read-only.
Definition: fcntl.h:19
SCE_SEEK_END
@ SCE_SEEK_END
Starts from the end of the file.
Definition: fcntl.h:42
SCE_O_CREAT
@ SCE_O_CREAT
Create.
Definition: fcntl.h:27
sceIoPwrite
int sceIoPwrite(SceUID fd, const void *data, SceSize size, SceOff offset)
Write output at offset.
sceIoLseek
SceOff sceIoLseek(SceUID fd, SceOff offset, int whence)
Reposition read/write file descriptor offset.
sceIoLseek32
int sceIoLseek32(SceUID fd, int offset, int whence)
Reposition read/write file descriptor offset (32bit mode)
sceIoClose
int sceIoClose(SceUID fd)
Delete a descriptor.
sceIoPread
int sceIoPread(SceUID fd, void *data, SceSize size, SceOff offset)
Read input at offset.
sceIoOpen
SceUID sceIoOpen(const char *file, int flags, SceMode mode)
Open or create a file for reading or writing.
sceIoRead
int sceIoRead(SceUID fd, void *data, SceSize size)
Read input.
sceIoWrite
int sceIoWrite(SceUID fd, const void *data, SceSize size)
Write output.
fcntl.h
SCE_O_WRONLY
@ SCE_O_WRONLY
Write-only.
Definition: fcntl.h:20