Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AGUIM2
New Contributor I
1,964 Views

Create text file on micro sd cardof edison breakout board

Hello all,

I'm a beginner on c++ language on eclispe for edison. I want to create (and write inside) a text file on the micro sd card of the edison Arduino breakout board. Someone can tell me how to do it please?

4 Replies
idata
Community Manager
55 Views

Hello Guimficus,

 

 

If you would like read/write on the Arduino Breakout Board's sd card interface you will have to go to the following path:

 

 

/media/sdcard

 

 

If you only want to create/edit text files, then I'd suggest you to use vi. You can go to http://www.howtogeek.com/102468/a-beginners-guide-to-editing-text-files-with-vi/ http://www.howtogeek.com/102468/a-beginners-guide-to-editing-text-files-with-vi/ to learn more about it.

 

 

Peter.
AGUIM2
New Contributor I
55 Views

Hello Peter,

The solution you propose me to create/edit files on micro sd card is using a linux terminal. But is ti not possible to do it by writing a c++ program, because I want to joint it with my other c++ files which I showed you in this discussion

Guimficus.

idata
Community Manager
55 Views

I'm sorry, I must have misread. If you would like to read/write a .txt file on the SD Card interface, I'd suggest you to check http://www.tutorialspoint.com/cplusplus/cpp_files_streams.htm http://www.tutorialspoint.com/cplusplus/cpp_files_streams.htm. This document is very helpful and in fact you will find a working example. The only modifications you will have to do to write on the SD Card are in the following lines:

 

 

outfile.open("afile.dat");

 

 

And

 

 

infile.open("afile.dat");

 

 

Instead of just the file name you will have to specify the full path where you would like to store it. For the SD Card, they will have to look like this:

 

 

outfile.open("media/sdcard/afile.dat");

 

 

And

 

 

infile.open("media/sdcard/afile.dat");

 

 

Try it and let me know if it helps.

 

Peter.
AGUIM2
New Contributor I
55 Views

Hello Peter,

I've tried what you told me. It walk very well . I'm now able to control my control, sd card and RTC module. Thank you!

Guimficus

Reply