How do I type the ¦ character on mac keyboard?

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

  1. macrumors newbie

    brightside1863

    Joined:
    Oct 7, 2010
    Location:
    Nottinghamshire, UK
    #1
    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

    Joined:
    Mar 29, 2009
    Location:
    USA
    #2
    Shift + the key above the return key?
     
  3. Moderator emeritus

    Joined:
    Jul 4, 2004
    #3
    You mean a pipe? Like so?

    |

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

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #4
    Is anyone e|se curious what a "WP program" is?

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

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #5
    I guess maybe I'm actually old enough to thing "WordPerfect" instead of "WordPress"?

    -Lee
     
  6. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #6
    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

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #7
    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

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #8
    You need to turn this feature on, its in...

    System Preferences->Keyboard (Keyboard Tab)
    AND
    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

    Joined:
    Feb 10, 2009
    Location:
    England
    #9
    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

    Sydde

    Joined:
    Aug 17, 2009
    #10
    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. thread starter macrumors newbie

    brightside1863

    Joined:
    Oct 7, 2010
    Location:
    Nottinghamshire, UK
    #11
    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

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #12
    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

    gnasher729

    Joined:
    Nov 25, 2005
    #13
    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. thread starter macrumors newbie

    brightside1863

    Joined:
    Oct 7, 2010
    Location:
    Nottinghamshire, UK
    #14

    Whizzer! Thanks gnasher729.
     

Share This Page