10

How can I write a null character on a MacBook Pro?

I'd prefer to use just the keyboard or something that I can reach everywhere, without using a third-party program.

Drathier
  • 1,462

2 Answers2

8

You can do this with the Unicode Hex Input method (enable it in System PreferencesLanguage & Text pane → Input Sources tab, and then select it from the menu item) by holding Option and typing "0000".

Warning: the null character is not allowed in C-language strings (it's used to indicate the end of the string), so not all programs will cope with it. In TextEdit, for example, you can insert a null into a document, but when you save the document it'll only save the part before the null.

3

It depends on your terminal. In Terminal.app and iTerm2, you can use ^@ (Ctrl + Shift + 2). See here.