copyStringToBuf method

void copyStringToBuf(
  1. String str
)

Copy the characters from str into buf255.

Implementation

void copyStringToBuf(String str) {
  if (str.length > 254) throw 'String too long: $str';
  var index = 0;
  for (var value in str.codeUnits) {
    buf255.elementAt(index).value = value;
    ++index;
  }
  // null terminated C string
  buf255.elementAt(index).value = 0;
}