This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

in file system



i want to write two buffers into the file i.e one buffer after another buffer.

i.e

char buff[100]={"tiva"};
char buff1[500]={"cseries");

iFResult = f_write(&g_sFileObject, buff, sizeof(buff) - 1,&ui32Byteswrite);

iFResult = f_write(&g_sFileObject, buff1, sizeof(buff1) - 1,&ui32Byteswrite);

but it is not working ,

i want the output i.e    tiva cseries

i try this program but it is not working..

do
{
//
// Read a block of data from the file. Read as much as can fit in the
// temporary buffer, including a space for the trailing null.
//
iFResult = f_write(&g_sFileObject,"tiva",6,&ui32Byteswrite);
iFResult = f_write(&g_sFileObject,"cseries",7,&ui32Byteswrite);
//
// If there was an error reading, then print a newline and return the
// error to the user.
//
if(iFResult != FR_OK)
{
UARTprintf("\n");
return((int)iFResult);
}

//
// Null terminate the last block that was read to make it a null
// terminated string that can be used with printf.
//
// buff[ui32Byteswrite] = 0;

//
// Print the last chunk of the file that was received.
//

}while(ui32Byteswrite ==13);

                                      

  • Hello Ravi

    The file handle has already been assigned to one file. How do you plan to use the same file handle at the same time for anothet file

    Regards
    Amit
  • Amit Ashara said:
    The file handle has already been assigned to one file. How do you plan to use the same file handle at the same time for anothet file

     Amit, it is writing two string, string are not written by length but full buffer (sizeof) so file contain first full buffer then second full buffer, first string has terminator...

     We are throwing our time to a complete lack of basic programming, I don't see file descriptor so we don't know also if file correctly open and closed.

     Amit, this is too much for me and I fear for you too, file descriptor is same but we are overtired. WE NEED A DIFFERENT FORUM POLICY or I fear you get exausted and is not amazing  see a good friend lose his time this way.

     I quit.