wow thanks for your help... as it turns out just tip #1 was cool enough :) i ended up not having that many commands... for now :)
anyway, i love this forum it is sooooo good as a C resource!!!!
...
Type: Posts; User: davo666
wow thanks for your help... as it turns out just tip #1 was cool enough :) i ended up not having that many commands... for now :)
anyway, i love this forum it is sooooo good as a C resource!!!!
...
hmm i have found while searching that i could create a function map where the string is the key and a pointer to the function is the value
could you give me a few tips on how would start to go...
Hello,
I have a socket server program which takes things like CMD:hci_scan as input into a char *
and i would like to know how i could differentiate between all the different commands and i do...
sorry, the platform is iPhone
so like a polling loop that asks the library every x interval?
thats kinda hacky...
Hello,
i have an event driven c library that needs to notify the thing it links with that a status has changed. i cant call a function because obviously it would be present at compile time of the...
hello,
I have an unsigned char array which is basically 17bytes long with a null terminator
in the form 0 0 : 1 1 : 2 2 : 3 3 : 4 4 : 5 5 \0
i can take the \0 off easily, but i would like to...
that interprets it as a 1 byte string, becuase it prints 'l' (ell) and quits, also if you add a trailing 0x00, (which is evident in my string) then it doesnt print anything...
this is becming an...
ok im going for the sprintf the bytes to a char array and going from there i found this piece of code does not compile
#include <stdio.h>
#include <wchar.h>
int main() {
i did read the man page... from my re-reading i changed %C to %c but otherwise i dont know what to do -- arg1 is a pointer to a wide char array? arg2 is the maximum length of the string (?) arg 3 is...
sorry, i got casted to (wchar_t) but that still didnt help... im using GCC on an ARM platform msdn is the last thing i would read :)
thanks
the double casting worked, you are great!
i still couldnt apply that to swprintf though :s but this is what i have so far:
name_len - 3 is the number of bytes, including the null termintor that...
i thought about the casting, but wouldnt that read 4 bytes at a time? also the bytes i need are 9 bytes in (i.e. the 8th element of the array)
ok, i will extrapolate:
i am getting an OBEX packet delivered over Bluetooth. one of the packet fields is 'file name' - in 2 byte unicode characters.
the problem is the array received is a void...
when i print byte for byte this sequence:
0x00 0x6C 0x00 0x6F 0x00
the letters 'l' and 'o' are printed but when i sprintf the 0x6c then 0x6f i get 'l' and nothing.
i then looked up 6f in...
reading at unicode.org it says it is O.K. to truncate 2 byte unicode (16bit big endian) code sequences to 1 byte because it will preserve characters c <= 127, like ascii.
this wold only stuff up...
thanks for the reply, say if the bytes are locked up in a char array, is there a way to copy the bytes into this wchat_t array 1 byte at a time, or do you need to copy it two bytes at a time?
...
Hello,
I was wondering about Unicode, specifically 2 byte characters, if i have an array of 2 byte unicode characters (each byte is an element) how would i be able to print these characters.
...
hello everyone,
i have a for looop that iterates through an array of bytes, each two byte sequence is a 2 byte wide character, i need to print each two byte sequence to a wchar_t array. I have...
yes, its definately with the function, i can print my bytes inside it and the error is occuring elsewhere in that func -- thanks for your help!
hmm, I think maybe my problem is in output()
here it is
int output(unsigned char *data) {
int num_bytes =2;
// use the rfcomm_pcb passed into the rfcomm_connected function as the...
phew! i though i was going insane :)
int output(unsigned char *data); //prototype
lol sorry
unsigned char data[1024] = { 0x0a, 0x00 };
thats how i initialise it
-- if i dont cast it gives errors
hello,
i have a function which is asking for an unsigned char * but when i initialise an unsigned char array
unsigned char data[1024];
and pass it like so:
wow! thankyou! return_string on its own printed as a string printed it exactly! i guess i cant access only the first character... oh well thanks!