Pages: [1]   Go Down
Author Topic: Sequential file naming on SD card  (Read 396 times)
0 Members and 1 Guest are viewing this topic.
Gloucester
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm struggling here a bit.
I want to write a fresh file each time the SD card is inserted.
e.g.
data0.csv
data1.csv
data2.csv

so I thought that something like
count++
fileName="data" & count & ".csv"
could work.
but this approach looks to be rubbish.
What is the correct approach?
Yours Simon M.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 553
Posts: 46267
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so I thought that something like
count++
fileName="data" & count & ".csv"
could work.
but this approach looks to be rubbish.
What is the correct approach?
The correct approach is to use code that stands a chance of working. No matter what type fileName is, the & operator is not the correct one to use.

Of course, you should be able to see from this comment that we don't know what type fileName is, so any help in getting a variable encoded in the variable is going to be vague.

If you'd read the sticky, you'd know that the requirement for posting here is to post your code (properly).
Logged

Offline Offline
Edison Member
*
Karma: 35
Posts: 1429
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This thread has info about that: http://arduino.cc/forum/index.php/topic,144336.0.html

Pete
Logged

Where are the Nick Gammons of yesteryear?

Pages: [1]   Go Up
Jump to: