Jun 20, 2014
03:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 20, 2014
03:45 AM
Hi. Everyone.
I tested the SD Card can read the file.
Source is shown below.
int file_Read(const char *pcFileName, long FilePoint)
{
FILE *ptr;
status_t status;
status_t status1;
status_t status2;
const char buffer[1024] = {0,};
uint32_t block_size;
uint32_t num_blocks;
ptr = fopen(pcFileName, "r+");
status1 = fseek(ptr, FilePoint, SEEK_CUR);
if (ptr == NULL)
return -1;
block_size = 40;
num_blocks = sizeof(char);
status2 = fread(&buffer, num_blocks, block_size, ptr);
status = fclose(ptr);
}
Point f_seek function is used to increase gradually from 0 to 4 when read only values that fall into the drainage.
if FilePoint = 0 -> Data Read Ok.
FilePoint = 1 -> Data Read Fail.
FilePoint = 2 -> Data Read Fail.
FilePoint = 3 -> Data Read Fail.
FilePoint = 4 -> Data Read Ok.
FilePoint = 5 -> Data Read Fail.
FilePoint = 6 -> Data Read Fail.
FilePoint = 7 -> Data Read Fail.
Do not know why this happens.
And I want to read only 1byte.
I tested the SD Card can read the file.
Source is shown below.
int file_Read(const char *pcFileName, long FilePoint)
{
FILE *ptr;
status_t status;
status_t status1;
status_t status2;
const char buffer[1024] = {0,};
uint32_t block_size;
uint32_t num_blocks;
ptr = fopen(pcFileName, "r+");
status1 = fseek(ptr, FilePoint, SEEK_CUR);
if (ptr == NULL)
return -1;
block_size = 40;
num_blocks = sizeof(char);
status2 = fread(&buffer, num_blocks, block_size, ptr);
status = fclose(ptr);
}
Point f_seek function is used to increase gradually from 0 to 4 when read only values that fall into the drainage.
if FilePoint = 0 -> Data Read Ok.
FilePoint = 1 -> Data Read Fail.
FilePoint = 2 -> Data Read Fail.
FilePoint = 3 -> Data Read Fail.
FilePoint = 4 -> Data Read Ok.
FilePoint = 5 -> Data Read Fail.
FilePoint = 6 -> Data Read Fail.
FilePoint = 7 -> Data Read Fail.
Do not know why this happens.
And I want to read only 1byte.
- Tags:
- IFX
0 Replies