Is it possible to write directory contents (as text) to another file on the SD card using this command ?
Thanks
Mmc_Fat_Dir
- janko.kaljevic
- Posts: 3565
- Joined: 16 Jun 2011 13:48
Re: Mmc_Fat_Dir
Hello,
It is possible and it is very simple to do.
Please try something like this:
Best regards.
It is possible and it is very simple to do.
Please try something like this:
Code: Select all
dim buffer as string[256]
dim fhandle as char
sub procedure fillbuffer(dim ch as byte)
buffer[i] = ch
inc(i)
end sub
....
Mmc_Fat_Dir(@fillbuffer)
buffer[i] = 0
fhandle = Mmc_Fat_Open("newfile.txt", FILE_APPEND, 0xA0)
Mmc_Fat_Write(buffer, length(buffer))
Re: Mmc_Fat_Dir
Thankyou !
BTW it's not possible to change directory and read a file from it ?
BTW it's not possible to change directory and read a file from it ?
- janko.kaljevic
- Posts: 3565
- Joined: 16 Jun 2011 13:48
Re: Mmc_Fat_Dir
Hello,
Yes it is possible, and very simple.
Please try this:
This will open file.txt for reading and store it's content in buffer.
I assumed that DIR_A is directory in root on SD card and file.txt is a file inside DIR_A.
Best regards.
Yes it is possible, and very simple.
Please try this:
Code: Select all
Mmc_Fat_ChangeDir("DIR_A")
Mmc_Fat_Open("file.txt", FILE_READ, 0)
size = Mmc_Fat_Get_File_Size()
for i = 0 to size
Mmc_Fat_Read(buffer[i])
next i
I assumed that DIR_A is directory in root on SD card and file.txt is a file inside DIR_A.
Best regards.