1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

How do I type the ¦ character on mac keyboard?

Discussion in 'Mac Programming' started by brightside1863, Oct 7, 2010.

  1. macrumors newbie


    I'm teaching myself C and can't find how to type the ¦ symbol into xcode. If I copy and paste from a WP program xcode throws up an error when building the code.
    I'm assuming that this is due to it being copied and pasted, unless xcode recognises another character as the OR bitwise operator?

    Can anyone help?
  2. macrumors 68000

    Shift + the key above the return key?
  3. Moderator emeritus

    You mean a pipe? Like so?


    Shift + Back Slash \ (next to return key)
  4. macrumors 68030


    Is anyone e|se curious what a "WP program" is?

    The on|y thing I can think of is Word Press.
  5. macrumors 68040


    I guess maybe I'm actually old enough to thing "WordPerfect" instead of "WordPress"?

  6. macrumors G5


    For the broken bar character ¦ use "Character Viewer". It won't compile unless you use it in a string literal or a comment. For the vertical line character | - what keyboard do you have? Many keyboards have it printed on the keyboard, for others check out the "Keyboard Viewer".
  7. macrumors 68030


    I actually did think of that, but I couldn't think of why someone would have a "program" in WordPerfect. You would think a C program from that era would be in .txt or some other plain text format/encoding.

    I kinda assumed WordPress because it was more logical to myself that the OP was copying a program from someone's blog or tutorial.

    Also I could see WordPress "stylizing" the text in some way by replacing | with ¦
  8. macrumors 68030


    You need to turn this feature on, its in...

    System Preferences->Keyboard (Keyboard Tab)
    System Preferences->Language&Text (Input Sources tab)

    EDIT: at least in 10.6, in earlier versions I believe it was only in Language&Text
  9. macrumors 6502a

    Meh, I was always a WordStar fan. Used it a lot (in plain text mode, or whatever it was called) for editing CBASIC files before compiling. :)
  10. macrumors 68000


    Typically, when you see "a WP program" it stands for the generic "Word Processor". Kind of an archaic phrase that has been out of usage for at least half a dozen Moores.
  11. macrumors newbie


    Thanks. Having the character viewer on the menu bar will come in very handy. As for the broken bar, it keeps throwing up a 'stray 302' error when it's used in any code i'm writing.
    Which from what I can find means that it's unrecognised?
  12. Moderator emeritus


    Does that include when used in a string literal? As mentioned earlier (post 6) it can't be used in code except in string literals.
  13. macrumors G5


    The "bitwise or" operator | and the "logical or" operator || are written using the vertical line, not the broken bar character. So yes, it won't compile, just like if you put any other random character in your code. For example, if (x ≠ y) won't compile either, nor will (a ≥ b) or (a ≤ b).

    Should work fine inside a string literal. What might come unexpected is that XCode will use UTF-8 for string literals, and the broken bar is not a single byte character. So strlen ("¦") will return 2, not 1 as you might expect.
  14. macrumors newbie



    Whizzer! Thanks gnasher729.

Share This Page