Question about library constructor


hello,

i making library current project.

i have following constructor in cpp file:

code: [select]
//****constructor****
parsedata::parsedata(
char header[8],
char footer[8],
int serialportread,
int serialportwrite,
char* datainput,
void match(),
int maxinputlength,
boolean debug)
{
 if (serialportread != null)
 {
   _serialportread = serialportread;
 }
}


i want give user possibility choose between 2 inputs, 1 can used:

int serialportread (to read input or serial port) or char* datainput (to read content of string)

can use:
code: [select]
if (serialportread != null) // check if entered @ serialportread position?
 {
   _serialportread = serialportread;
 }
else
{
  _datainput = datainput ;
}


or there nifty on how this?

thanks in advance,

/me

what serialportread , serialportwrite used later?

the simplest thing in rest of code, check see if _datainput null. if is, no string read provided, therefore user wanted read serial port.


Arduino Forum > Forum 2005-2010 (read only) > Software > Development > Question about library constructor


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums