Byteprint() will return the number of bytes written, though reading that number is optional.

println

Description

Print data, followed by a carriage return and newline, to the File, which must have been opened for writing. Prints numbers as a sequence of digits, each an ASCII character (e.g. the number 123 is sent as the three characters '1', '2', '3').

Syntax

file.println(data)file.println(data, BASE)

Parameters

data: The numbers or character string to printBASE: The base in which to print numbers (BYTE, BIN, DEC, HEX, OCT)

Returns

Byteprintln() will return the number of bytes written, though reading that number is optional.

seek

Description

Seek to a new position in the file, which must be between 0 and the size of the file (inclusive).

Syntax

file.seek(unsigned long pos)

Parameters

pos: The position to which to seek (unsigned long)

Returns

True for success, false for failure (boolean).

size

Description

Get the size of the file.

Syntax

file.size()

Parameters

None

Returns

The size of the file in bytes (unsigned long).

read

Description

Reads a byte from the file.

Syntax

file.read()

Parameters

None

Returns

The next byte (or character), or -1 if none is available (or at the end of a file).

write

Description

Write data or a character string to the file.

Syntax

file.write(data)file.write(buf, len)

Parameters

data: The byte, char, or string (char *) to writebuf: An array of characters or byteslen: The number of elements in buf

Returns

Bytewrite() will return the number of bytes written, though reading that number is optional.

isDirectory

Description

Directories (or folders) are special kinds of files; this function reports if the current file is a directory or not.

Syntax

file.isDirectory()

Parameters

None

Returns

True if directory, false if file.

openNextFile

Description

Reports the next file or folder in a directory.

Syntax

file.openNextFile()

Parameters

None

Returns

char: The next file or folder in the path.

rewindDirectory

Description

rewindDirectory() will bring you back to the first file in the directory, used in conjunction with openNextFile().

Syntax

file.rewindDirectory()

Parameters

None

Returns

None

Sample Program

This sample program runs a test of all operations (write, read, get size, remove) by accessing the Micro SD on the back of the GR-ROSE board.