Does ofstream in SDFat work with Fat32

Status
Not open for further replies.

bvernham

Well-known member
I have used SDFat with Fat and ofstream with never a hick up.

Try to copy the same code to the Teesnsy 4.1 and nothing.

I can open, read/write flawlessly with File32 (for some reason when I want to the Beta.10 and 1.8.15 File no longer exists which I do not care because the Teensy has plenty to handle Fat32.

Anyways, compile the code, file never opens.

No compiler error or warning.

Thoughts?

Thanks

Bruce
 
I have used SDFat with Fat and ofstream with never a hick up.

Try to copy the same code to the Teesnsy 4.1 and nothing.

I can open, read/write flawlessly with File32 (for some reason when I want to the Beta.10 and 1.8.15 File no longer exists which I do not care because the Teensy has plenty to handle Fat32.

Anyways, compile the code, file never opens.

No compiler error or warning.

Thoughts?

Thanks

Bruce

You probably have to enable it in the config.h file like this:
Code:
//------------------------------------------------------------------------------
/**
 * Set INCLUDE_SDIOS nonzero to include sdios.h in SdFat.h.
 * sdios.h provides C++ style IO Streams.
 */
#define INCLUDE_SDIOS 1
By default I think it is set to 0, at least mine was. After I changed it to 1 I was able to use cout and cin.
 
Code:
#include <SdFat.h>
#include <sdios.h>

I always include sdio.h.

Do I need to do both?

Like I said with the DUE, did the above and work as expected.

Thanks

Bruce
 
Serial works great!

I am talking about writing log files to an SD card.

Thanks for the help anyways.

Bruce
 
Serial works great!

I am talking about writing log files to an SD card.

Thanks for the help anyways.

Bruce

Sorry miss understood what you were asking thought we were still taking about the question you asked on ofstream.
 
Sorry miss understood what you were asking thought we were still taking about the question you asked on ofstream.


ofstream Class Reference

Detailed Description
file output stream.

The documentation for this class was generated from the following file:
ArduinoSdFat/libraries/SdFat/src/iostream/fstream.h

For your reference.

Brue
 
Status
Not open for further replies.
Back
Top