We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi Forum! I have declared an char-array, for a simple Data stream buffer of bits: char data[] = "101101010011111@". And now just want cast this items to a integer-value. How can i do this in simplest way, without sum the bits bitwise via pointer? cu O. Swid
You have already been given the means to covert an array of binary digit characters in this thread: http://www.keil.com/forum/docs/thread4249.asp Since you are asking again, one can only assume that the answers given there were inadequate. To be of further assistance, you'll need to tell us what there was about the previous answers that did not suit your requirements. "And now just want cast this items to a integer-value." Your use of "cast" here in a C forum is quite confusing, since "cast" has a specific meaning and use in the C language that is entirely incompatible with your apparent intentions. Would we better understand you to mean "convert"? "...without sum the bits bitwise via pointer?" I don't understand this requirement at all. Could you please restate your root requirement in a different way?
You cannot "cast" an array of characters (or a C string, or an idiosyncratic string format with an '@' on the end). You can convert strings to integers with various functions, as I've mentioned before. The C cast operator and syntax will not avail you. (... Flame of Udun. And unless you get this assignment right: you... SHALL NOT... PASS!)
Ah, I neglected to mention Drew's contributions to the problem here: http://www.keil.com/forum/docs/thread4250.asp And that again begs the question: What are we doing wrong, or what requirements are you not stating properly, that has caused you to reject the feedback given thusfar?