Hi Kazper,
I checked your code into a virgin CircleOS application, and I saw you forgotten to open the root directory, before creating the file.
Here is my "MENU_code Application_Ini" code :
[CODE]
VOLINFO volume_info;
DIRINFO directory_info;
DIRENT directory_entry;
FILEINFO file_info;
u32 StartMBR;
// Ensure that the current OS version is recent enough
if(strcmp(UTIL_GetVersion(), NEEDEDVERSION) < 0)
{
return MsgVersion();
}
// mount MMCSD
StartMBR=FS_Mount(MMCSD_SDIO);
if (StartMBR == 0xFFFFFFFF)
{
DRAW_Puts("\n No SDCARD");
return -1;
}
// Open volume on first partition (0)
if (FS_GetVolumeInfo(0, StartMBR, &volume_info))
{
DRAW_Puts("\nErr: GetVolInfo");
return -1;
}
// Open root directory
if (FS_OpenDirectory(&volume_info, "", &directory_info))
{
DRAW_Puts("\nErr: Open Root");
return -1;
}
//Open selected file
if (FS_OpenFile(&volume_info, "test2.txt",FS_WRITE, &file_info))
{
DRAW_Puts("\n Err op: File");
return MENU_Quit();
}
u32 write_length =6;
// FS_WriteFile (&file_info, (u8 *)ylog , &write_length,sizeof(ylog));
FS_WriteFile (&file_info,(u8 *)"testte", &write_length,6);
FS_Close (&file_info);
FS_Unmount (MMCSD_SDIO);
[\CODE]
So the file appeared on the windows explorer and can be opened, and visualized.
I checked with success with CircleOS v3.8 and both a 64Mb and a 2Gb SDCard.
For write example on a SDCard, take a look to the "Dictaphone" example.
Regards,
Yves