Exemple #1
0
AREXPORT void ArLMS1XXPacket::resetRead(void)
{
  myReadLength = 1;

  myCommandType[0] = '\0';
  myCommandName[0] = '\0';

  bufToStr(myCommandType, sizeof(myCommandType));
  bufToStr(myCommandName, sizeof(myCommandName));
}
AREXPORT double ArNetPacket::bufToDouble(void)
{
  char buf[256];
  char *endPtr;
  double ret;

  bufToStr(buf, sizeof(buf));
  if (strncmp(buf, "-INF", sizeof(buf)) == 0)
  {
	ret = -HUGE_VAL;
	return ret;
  }
  else if (strncmp(buf, "INF", sizeof(buf)) == 0)
  {
	ret = HUGE_VAL;
	return ret;
  }
  else
  {
	ret = strtod(buf, &endPtr);
	if (endPtr[0] == '\0' && endPtr != buf)
	  return ret;
	else
      return 0;
  }
}