Hello all, I have partially converted my MUD to bitfields, and I was wondering what the best way is to print them out. Here's what I have now: void test_print(struct char_data *temp) { int i, *j; CLEAR_BITS(PLR_FLAGS(temp)); /* just a test, set some bits */ SET_BIT(PLR_FLAGS(temp), PLR_KILLER); SET_BIT(PLR_FLAGS(temp), PLR_LOADROOM); for (i = 0, j = (int*) &PLR_FLAGS(temp); i < sizeof(PLR_FLAGS(temp)); i++) { printf("Bit #%2i == %3s\n", i, ONOFF(j[i])); } } And here's the output: Bit # 0 == ON Bit # 1 == OFF Bit # 2 == OFF Bit # 3 == OFF It seems to be reading the values as full integers (like I told it to :->) but how can I get it to step through each bit? Thanks in advance... -- Wyatt Bode +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list_faq.html | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST