First time posting on here...
I have been struggling with passing data through a pipe and ensuring that it is valid on the other side. I am using braces as delimiters to check the output and this works great for strings...however the struct i have created is using these delimiters and i want to check on the other side whether or not it is valid data. However, when i check for the null character '\0' it always is the next character on the struct that has been passed. In other words i would expect that after i get the '{' delimeter the next character would be whatever is in my struct.
And this is what the structure looks like:Code:ptr = msg_buff; offset = 0; while((*ptr != '\0') && (*ptr != '{')){ *(bslptr)++; offset++; } if(*ptr == '{'){ msg_buff=ptr; bytesleft = (MSG_LEN - offset); totalbytes = MSG_LEN - bytesleft; } else if (*bslptr == '\0') { offset = 0; totalbytes = 0; bytesleft = MSG_LEN; }
Code:typedef struct{ unsigned char head; unsigned int code; unsigned short type; unsigned short set; unsigned char tail; }MESSAGE;