Reference.SDopen History

Hide minor edits - Show changes to output

November 01, 2011, at 09:34 PM by Scott Fitzgerald -
Deleted lines 8-9:
Note: '''only one file can be open at a time.'''
December 22, 2010, at 10:54 PM by David A. Mellis -
Changed lines 22-25 from:
* FILE_READ: open the file for reading
* FILE_TRUNCATE: open the file for writing, deleting its current contents
* FILE_APPEND: open the file for writing, appending to the end of the file
to:
* FILE_READ: open the file for reading, starting at the beginning of the file.
* FILE_WRITE: open the file for reading and writing, starting at the end of the file.
December 22, 2010, at 07:16 PM by David A. Mellis -
Changed lines 9-10 from:
Note that only one file can be open at a time.
to:
Note: '''only one file can be open at a time.'''
November 29, 2010, at 05:50 AM by David A. Mellis -
November 29, 2010, at 05:50 AM by David A. Mellis -
Changed lines 14-16 from:
SD.open(filepath, write)\\
SD.open(filepath, write, append)
to:
SD.open(filepath, mode)
Changed lines 20-23 from:
write (''optional''): whether to open the file for writing; defaults to false (read-only) - ''boolean''

append (''optional''): if opening the file for writing, whether to append to the end of the file (or overwrite its current contents); defaults to true (append) - ''boolean''
to:
mode (''optional''): the mode in which to open the file, defaults to FILE_READ - ''byte''. one of:

* FILE_READ: open the file for reading
* FILE_TRUNCATE: open the file for writing, deleting its current contents
* FILE_APPEND: open the file for writing, appending to the end of the file
November 21, 2010, at 05:55 PM by David A. Mellis -
Changed lines 13-16 from:
SD.open(filename)\\
SD.open(filename, write)\\
SD.open(filename, write, append)
to:
SD.open(filepath)\\
SD.open(filepath, write)\\
SD.open(filepath, write, append)
Changed lines 19-20 from:
filename: the name of the file to open, which can include directories (delimited by forward slashes: /) - ''char *''
to:
filename: the name the file to open, which can include directories (delimited by forward slashes, /) - ''char *''
November 21, 2010, at 05:53 PM by David A. Mellis -
Changed lines 7-8 from:
Opens a file on the SD card. If the file is opened for writing, it will be created if it doesn't already exist.
to:
Opens a file on the SD card. If the file is opened for writing, it will be created if it doesn't already exist (but the directory containing it must already exist).
November 21, 2010, at 05:51 PM by David A. Mellis -
Changed lines 21-24 from:
write (''optional''): whether or not to open the file for writing; defaults to false (read-only) - ''boolean''

append (''optional''): whether or not to append to the end of the file (or overwrite its current contents); defaults to true (append) - ''boolean''
to:
write (''optional''): whether to open the file for writing; defaults to false (read-only) - ''boolean''

append (''optional''): if opening the file for writing, whether to append to the end of the file (or overwrite its current contents); defaults to true (append) - ''boolean''
November 21, 2010, at 05:50 PM by David A. Mellis -
Changed line 30 from:
* File: [[FileClose | close()]]
to:
* [[FileClose | File: close()]]
November 21, 2010, at 05:50 PM by David A. Mellis -
Changed line 30 from:
* File.[[FileClose | close()]]
to:
* File: [[FileClose | close()]]
November 21, 2010, at 05:50 PM by David A. Mellis -
Added lines 1-30:
[[SD]]

!!open()

!!!!Description

Opens a file on the SD card. If the file is opened for writing, it will be created if it doesn't already exist.

Note that only one file can be open at a time.

!!!!Syntax

SD.open(filename)\\
SD.open(filename, write)\\
SD.open(filename, write, append)

!!!!Parameters

filename: the name of the file to open, which can include directories (delimited by forward slashes: /) - ''char *''

write (''optional''): whether or not to open the file for writing; defaults to false (read-only) - ''boolean''

append (''optional''): whether or not to append to the end of the file (or overwrite its current contents); defaults to true (append) - ''boolean''

!!!!Returns

a File object referring to the opened file; if the file couldn't be opened, this object will evaluate to false in a boolean context, i.e. you can test the return value with "if (f)".

!!!!See also
* File.[[FileClose | close()]]

Share