I know the method of how to convert an array of string to ASCII code but it does not read the rest of the words after spaces between the string. For example i enter the message" Hi how are you". When it convert to ASCII code, it only convert till "Hi" and display the code and rest is lost, and the worst is the output terminate immediately when it does not convert the rest of the message.
So far I have done this:
Ok. I get to convert all the messages into ASCII code, but it convert the space as well. How do i display only the words without the space as well?
TRANSMITTER
===========
Enter message: hi how are you
The ascii code for the message h : 104
The ascii code for the message i : 105
The ascii code for the message : 32
The ascii code for the message h : 104
The ascii code for the message o : 111
The ascii code for the message w : 119
The ascii code for the message : 32
The ascii code for the message a : 97
The ascii code for the message r : 114
The ascii code for the message e : 101
The ascii code for the message : 32
The ascii code for the message y : 121
The ascii code for the message o : 111
The ascii code for the message u : 117
And why do you want to define such a big buffer size though I don't understand your point. Also, you mean the parity() function that i need to initialize it to x? I have tried like this
To not print the spaces, just check for them. If ascii[x] is not equal to 32, then print the line and value. Like so.. if ( ascii[x]!=32) This goes right below ascii[x] = int(message[x]);
parity-wise, I don't know what you need to init x to. But if you don't init to something, the result of the ^= operator will be meaningless as it uses the current value,
256 is not a large buffer for a normal Windows program. But 30 is tiny. Unless you're programming some miniscule embedded system!
By chance, "And why do you want to define" is 29 chars, which will just fit in your buffer along with a null terminator. I don't thinks its impossible that a user will type a longer sentence than that. I would prob use 1024, which is safely long enough than any normal sentence.