objective c - ASCII Code to NSData -
i'm trying figure out esc/pos commands , need code "gs" (ascii code 29) put nsdata.
currently can put strings want print without problems using code:
nsstring *str = @"text want print"; nsdata *data = [str datausingencoding:nsasciistringencoding]; is there easy way using either c++ or obj-c?
c, c++, , objective-c let put arbitrary ascii codes string using so-called escape sequences.
escape sequence start either in \x followed 2 hex digits, or \0 followed 3 octal digits.
ascii gs 29 in decimal or 1d in hex, can put gs in nsdata this:
nsdata *data = [@"\x1d" datausingencoding:nsasciistringencoding];
Comments
Post a Comment