User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
295
Cf_Fat_Assign
Prototype
unsigned int Cf_Fat_Assign(char *lename, char le_cre_attr);
Description Assigns le for le operations (read, write, delete...). All subsequent le operations will be applied over
the assigned le.
Parameters - lename: name of the le that should be assigned for le operations. The le name should be in
DOS 8.3 (le_name.extension) format. The le name and extension will be automatically padded with
spaces by the library if they have less than length required (i.e. “mikro.tx” -> “mikro .tx “), so the user
does not have to take care of that. The le name and extension are case insensitive. The library will
convert them to proper case automatically, so the user does not have to take care of that.
Also, in order to keep backward compatibility with the rst version of this library, le names can be
entered as UPPERCASE string of 11 bytes in length with no dot character between the le name and
extension (i.e. “MIKROELETXT” -> MIKROELE.TXT). In this case the last 3 characters of the string
are considered to be le extension.
- le_cre_attr: le creation and attributes ags. Each bit corresponds to the appropriate le
attribute:
Returns - 0 if le does not exist and no new le is created.
- 1 if le already exists or le does not exist but a new le is created.
Requires CF card and CF library must be initialized for le operations. See Cf_Fat_Init.
Example
// create le with archive attributes if it does not already exist
Cf_Fat_Assign(“MIKRO007.TXT”,0xA0);
Notes Long File Names (LFN) are not supported.
Bit Mask Description
0 0x01 Read Only
1 0x02 Hidden
2 0x04 System
3 0x08 Volume Label
4 0x10 Subdirectory
5 0x20 Archive
6 0x40 Device (internal use only, never found on disk)
7 0x80
File creation ag. If the le does not exist and this ag is
set, a new le with specied name will be created.