Saturday, June 19, 2010

Bitwise Operator



This is what I learned about bitwise operators the other day (I set it up in a table so that I can remember what goes where)







































Operator
Syntax
Example
Bitwise Not ~a ~0111 = 1000
Bitwise OR a | b 0111 | 0000 = 0111
Bitwise And a & b 0111 & 1111 = 0111
Bitwise XOR a ^ b 0111 | 1111 = 1000
Bitwise Shift Left a << 2 0111 = 1100
Bitwise Shift Right a >> 2 0111 >> 2 = 0001
Bitwise Shift Right a >> 2 1000 >> 2 = 1110


*Right shift depends on sign and unsigned, unsigned always put preceding number(s) as 0, if it is signed, it depends on if the first number is 1 or 0, if it is 1 then the preceding number(s) become 1
*(I hope I copied it right)*

Wednesday, June 9, 2010

[HelloÍÍÍ] iof_displayMenuItem

Struggling once again... this time I am having funny characters with my output (of spaces) when I use iof_displayMenuItem


I used the iof_display to output the menu. If I use iof_putch(' '), it'll output a space but if I use it in a loop, "Ì" characters show instead of spaces...

I am using this as my tester for the iof_displayMenuItem

#include "iof.h"

int main()
{
char str[5] = "HELLO";
iof_init();
iof_clrscr();
iof_displayMenuItem("[]", str, 15, 1, 10, 1);
iof_getch();
iof_end();
return 0;
}