How to convert a char array into an int in C++?

Let me rephrase my question How do you convert a long int into a char?

  • I am making a code for the gps to send the lat and lon to another arduino via transmitter and receiver. however the virtualwire only sends char and not long int or float. how do I ...show more

  • Answer:

    A char is one byte. Is the number you're sending more than one byte? If it isn't, you should be able to cast the long/int and send it. (see link) If it is more than one byte, you will need to devise some way to encode it into multiple bytes. A simple way is to send mod(256) the number, then divide by 256 and repeat.

DJAJY73FROGL7CMCGQ7URNKHRU at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.