Praveen Kumar(deleted)
|
Write to filesystem from a program
|
Praveen Kumar(deleted)
09/14/2014 4:51 AM
post111706
|
Write to filesystem from a program
Hi All,
I am trying to create a new file and write to a new file but when i try to open the new file it is crashing the program.
I am working in Neutrino 6.6 and sabrelite board with bsp-freescale-mx6q-sabrelite-SDP6.6 BSP.
I have created a partition in the SD Card with the command fdisk of DOS filesystem type.
My sample code.The mountret is 0 in the below call
FILE *fp;
int mountret=mount("/dev/hd0t1","/usr",_MOUNT_REMOUNT,"dos",'\0',-1);
fd=fopen("/usr/test/data.txt",'a');
if(fd==NULL)
{
printf("fopen error");
}
datbuf.chardata='a';
datbuf.floatdata=1.152;
datbuf.intdata=20;
fwrite((const void*)&datbuf,sizeof(datbuf),1,fd);
fclose(fd);
Thanks in advance for your replies,
With regards,
Praveen Kumar
|
|
|