What does 'returns an instance' mean ?


hi,

i'm working way through book on arduino programming , i'm kind of stuck @ bit if loops.  the code writing data sd card, , there line earlier on says 'file file;'.  i'm guessing command 'file' function of sd.h library ?  but command ?  the book skims on it.

later on, there if loop starts with;

code: [select]
file = sd.open("data.txt", file_write);
if (file) {
while (millis() < (runningtime * msmin)) {
byte value = map(analogread(sensor), sensormin, sensormax, 0, 255);
file.write(value);
delay(interval);
}


what don't line " if (file) { ".
if file what ?  i know means "if file (is true)" - isn't !  i'm used seeing "if (a == 5)".

i have feeling confusion rooted in phrase 'returns / creates instance' , i'm testing 'if (file)' statement.... i'm not sure !

any pointers appreciated !

thanks !


if file what ?


if file true. true means non zero. if sd.open successful, non-zero value returned. if not, 0 returned evaluates false.

code: [select]
if (18)

always runs code in if block because 18 non zero.

code: [select]
if (0)

never runs code in if block


Arduino Forum > Using Arduino > Programming Questions > What does 'returns an instance' mean ?


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62