Writing on file SD card

Hello,
I am trying to writing in a txt file in this way:

int ans[10]; int q=0;
out_file.write((uint8_t )current->id); 
       out_file.print("\n");
        
        ans[q] = current->id;
        q++;

when I open the file, I got on unreadable data but when I print the array I can read the data without any error.
Is my writing in file wrong?

Post ALL the code. Usually, nothing useful can be concluded from a snippet.

I can't, it very longs code!

I can't

Yes, you can. Use code tags, as explained in the "How to get the best out of this forum" post.

However, if you have a problem with code, the best approach is to post the minimal complete example code required to reproduce the problem.

I worked when I use out_file.print()
But I need to use write()

why?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.