User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
371
Prototype
unsigned int Mmc_Fat_Assign(char *lename, char le_cre_attr);
Description Assigns le for le operations (read, write, delete...). All subsequent le operations will be applied on
an assigned le.
Parameters - lename: name of the le that should be assigned for le operations. File 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 no
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 le name and
extension (i.e. “MIKROELETXT” -> MIKROELE.TXT). In this case 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 - 1 - if le already exists or le does not exist but a new le is created.
- 0 - if le does not exist and no new le is created.
Requires MMC/SD card and MMC library must be initialized for le operations. See Mmc_Fat_Init.
Example
// create le with archive attribute if it does not already exist
Mmc_Fat_Assign(“MIKRO007.TXT”,0xA0);
Notes Long File Names (LFN) are not supported.
Mmc_Fat_Assign
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 le does not exist and this ag is set, a
new le with specied name will be created.