Start here: https://golang.org/ref/spec#Rune_literals. Then read the next
section about string literals and note that rune escape sequences are
recognized inside double-quoted strings. For example, your feed paper
command could be written "\033J\004" or "\x1bJ\x04". There are other ways,
of course, to construct such strings that may be more readable by using
constant declarations such as `const Esc '\x1b'`.

On Sat, Apr 3, 2021 at 2:55 PM Hugh Myrie <[email protected]> wrote:

> Given the following, how do I send escape codes to print?
>
> for _, line := range lines {
> fmt.Fprintf(p, "%s\r\n", line)
> }
>
> How do I send escape sequences using the above print command?
>
> Below is a C# example:
>
> output = Chr(&H1D) & "V" & Chr(66) & Chr(0);
>
> I want to send the escape codes to a receipt printer to control the
> perform cetrain functions.
>
> Some commands include:
> ESC "J" 4  <--Feed paper
>
>  GS "!" 0x11  <-- change character size
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/b420e7fc-55c4-452c-822e-e84a3b96da85n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/b420e7fc-55c4-452c-822e-e84a3b96da85n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD-UGZvQYjicETENUf4oubxGb-miHxeLqN1_%2BhwfDUi__A%40mail.gmail.com.

Reply via email to