drive | Extension socket number |
*fname | File name |
*buf | Read address |
nblock | Number of blocks to be read |
*time | Time stamp |
flag | Flag |
BUD_FLAG_VERIFY:Verify enabled | |
BUD_FLAG_COPY(n):Copy flag ("n" is the value of the copy flag) |
BUD_ERR_OK | Processing request was received | |
BUD_ERR_BUSY | Busy - request could not be accepted |
The following values can be designated for drive that specifies extension sockets.
BUD_DRIVE_A1 | Extension socket 1 on board A |
BUD_DRIVE_A2 | Extension socket 2 on board A |
BUD_DRIVE_B1 | Extension socket 1 on board B |
BUD_DRIVE_B2 | Extension socket 2 on board B |
BUD_DRIVE_C1 | Extension socket 1 on board C |
BUD_DRIVE_C2 | Extension socket 2 on board C |
BUD_DRIVE_D1 | Extension socket 1 on board D |
BUD_DRIVE_D2 | Extension socket 2 on board D |
In a normal application, this function saves an entire file. If a file with the same name already exists, the old file is deleted. However, if the file with the same name was an executable file, an error results. In addition, the address that is specified for buf must be on a four-byte boundary.
Sint32 ret; Sint32 blocks, flag; BUS_TIME time; SYS_RTC_DATE rtc; extern char SaveData[]; /* Data to be saved (512*10 bytes) */ : blocks = 10; /* File size is 10 blocks */ flag = BUD_FLAG_VERIFY | BUD_FLAG_COPY(0x00); /* Verify enabled | Set copy flag to 00H */ syRtcGetDate( &rtc ); time = ( BUS_TIME )rtc; /* Time stamp setting */ ret = buSaveFile(BUD_DRIVE_A1, "SAVEDATA", SaveData, blocks, &time, flag); if (ret == BUD_ERR_OK) { /* Save request was successful */ } else { /* Save request failed (busy) */ } :
The following are the completion statuses for this function that are obtained by buStat():
BUD_ERR_OK | Normal end |
BUD_ERR_NO_DISK | Memory card not found |
BUD_ERR_UNFORMAT | Disk not formatted |
BUD_ERR_FILE_NOT_FOUND | File not found |
BUD_ERR_CANNOT_OPEN | Cannot open file |
A save requires (number of blocks being saved x 5 Int). (Depending on the status of other extension sockets, the time required to save a file varies.)