_CP_open

_CP_open is equivalent to the open string1,string2 to fd BASIC statement.

Syntax

int _CP_open(int* fd, CPSTR* string1, CPSTR* string2)

Upon successful return, the first parameter is a pointer to an integer file descriptor that can be passed to other file system calls.

Parameter(s)

string1 Should be dict or data, or can be passed as _CP_str_null.
string2 Should be the file name.

Description

This function returns -1 if an error occurs. The error code is contained in _CP_errno.

Example(s)

CPSTR * s = _CP_mkstr("myfile");
int f;
 
_CP_open(&f,_CP_str_null,s);
_CP_clearfile(f);
_CP_close(f);