Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

brightside1863

macrumors newbie
Original poster
Oct 7, 2010
3
0
Nottinghamshire, UK
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?
 
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?

Shift + the key above the return key?
 
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?

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".
 
I guess maybe I'm actually old enough to thing "WordPerfect" instead of "WordPress"?

-Lee

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 ¦
 
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".

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
 
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.
 
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

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?
 
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?

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.
 
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?

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).


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.

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.
 
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.


Whizzer! Thanks gnasher729.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.