while doing this i am not able to store everything into the req_msg variable becuase of the '\0xd' (Carriage return) in every req_line1..4.
can somebody please tell me how do i format this data.. .i need line is a segment here and each segment mush end with the '\0xd' and send everything together for processing...
Everything all in one line with carriage returns in the middle. How are you verifying what data is printed? Keep in mind that if you print it to a console, a carriage return sends the cursor to the beginning of the line!
Thank you so much for your reply. Yes, right when i print using the printf it messages is being overwritten to the begining of the line. Not sure how to fix this.
As you said i want every thing in one line with carriage return in the middle. Can you hlep me with the 'C' source code.. or just brief me.
There are few extra characters are getting appended into the req_msg variable. When i print out the hex decimal values (using printf ("%0X", req_msg[i])) for this. here is what it is printing...
[D] [1C] [D] [7F] [45] [4C] [46] [1] [2] [1]
My last line ends with '\0xD', '\0x1C' and '\0XD' print here correctly. But appends with some junk values at the end [7F] [45] [4C] [46] [1] [2] [1] not sure where how it's printing this values. Can somebody please help me...
Yes, checking beyond the end of your string may show invalid values -- you never set it to anything else, so its contents could be anything. So what? sprintf will always end its strings in a NULL, preventing any of the garbage from being used.
Or, if your program does not place the null correctly, there may be something funny going on with buffer sizes. Make sure all your character arrays are large enough to hold their strings.