Skip to main content
added 108 characters in body
Source Link
ocrdu
  • 1.8k
  • 3
  • 12
  • 24

Not sure if or why you want to convert char*char* to intint, but if you need to, there are atoi(), atol(), strtol(), strtoul() to consider, or rolling your own function.

Pros and cons are discussed here. Main thing to note is that atoi() and atol() have no error handling, but if the char* you feed them is completely under control and predictable, that need not be a problem.

BTW I would try to get the websocket to send the correct single bytes instead of string representations of numbers, if at all possible.

Not sure if or why you want to convert char* to int, but if you need to, there are atoi(), atol(), strtol(), strtoul() to consider, or rolling your own function.

Pros and cons are discussed here. Main thing to note is that atoi() and atol() have no error handling.

BTW I would try to get the websocket to send the correct single bytes instead of string representations of numbers, if at all possible.

Not sure if or why you want to convert char* to int, but if you need to, there are atoi(), atol(), strtol(), strtoul() to consider, or rolling your own function.

Pros and cons are discussed here. Main thing to note is that atoi() and atol() have no error handling, but if the char* you feed them is completely under control and predictable, that need not be a problem.

BTW I would try to get the websocket to send the correct single bytes instead of string representations of numbers, if at all possible.

added 139 characters in body
Source Link
ocrdu
  • 1.8k
  • 3
  • 12
  • 24

Not sure if or why you want to convert char* to int, but if you need to, there are atoi(), atol(), strtol(), strtoul() to consider, or rolling your own function.

Pros and cons are discussed here. Main thing to note is that atoi() and atol() have no error handling.

BTW I would try to get the websocket to send the correct single bytes instead of string representations of numbers, if at all possible.

Not sure if or why you want to convert char* to int, but if you need to, there are atoi(), atol(), strtol(), strtoul() to consider, or rolling your own function.

Pros and cons are discussed here. Main thing to note is that atoi() and atol() have no error handling.

Not sure if or why you want to convert char* to int, but if you need to, there are atoi(), atol(), strtol(), strtoul() to consider, or rolling your own function.

Pros and cons are discussed here. Main thing to note is that atoi() and atol() have no error handling.

BTW I would try to get the websocket to send the correct single bytes instead of string representations of numbers, if at all possible.

Source Link
ocrdu
  • 1.8k
  • 3
  • 12
  • 24

Not sure if or why you want to convert char* to int, but if you need to, there are atoi(), atol(), strtol(), strtoul() to consider, or rolling your own function.

Pros and cons are discussed here. Main thing to note is that atoi() and atol() have no error handling.