Limit
Limit

Reputation: 458

How do I get the information of this string?

I am trying to debug a method right now and when I do an info locals, I get the following output:

buf = "@i\001\000\000\000\000\000\364\000\000\000\000\000\000\000\240\366fU", '\000' repeats 11 times

My question is, does \0 here mean the null character or are these characters \ and 0? I asked this because I was expecting the string length to be less than 40 characters.

Upvotes: 0

Views: 461

Answers (2)

Ian Abbott
Ian Abbott

Reputation: 17438

It's a C string escape sequence. A \ followed by 1, 2 or 3 octal digits represents an unsigned character with that octal value. As many octal digits as possible up to a maximum of 3 form part of the escape sequence, so \001 represents a single character with octal value 1. \364 represents a single character with octal value 364, which is binary 11110100, hex f4, and decimal 244 (64*3 + 8*6 + 4).

Upvotes: 4

The Javatar
The Javatar

Reputation: 719

\0 is the null character, same goes with \000. Separated \ and 0 should be noted as '\\' and '0'

Upvotes: 0

Related Questions