Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6156949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:42:04+00:00 2026-05-23T20:42:04+00:00

I want to know the method of converting an integer into char/string and vice-versa

  • 0

I want to know the method of converting an integer into char/string and vice-versa also.

I have already used sprintf(&charvar,”%d”,&intvar) but it produces wrong output, possibly garbage.

i have also heard atoi() in gcc has bugs.Reference:GCC atoi bug

What is the other method to convert string/char back to int ?

Actually i want to send an integer from one machine to another using SOCK_STREAM .

//EDIT : I forgot to tell that sprintf() does conversion and returns positive value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:42:05+00:00Added an answer on May 23, 2026 at 8:42 pm

    If you want to send an integer to another machine you can send it as binary data, just by sending the intvar directly to the stream, you don’t have to convert it to a char first. That will only introduce problems with knowing the length of the data as different values generate different lengths of strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have method for converting array of Booleans to integer. It looks like this
I want to know how I can run a method in a separate thread?
OK, I know what you're thinking, "why write a method you do not want
I want to know which tool can be used to measure the cyclomatic complexity
i want to save current date+time into database and also want to retrieve it.
Possible Duplicate: Converting string in C# I want to camelize a string, for example:
I want to know the current input method the user is typing in such
I want to know how to safely call a WCF web service method. Are
I have converting this method from vb.net to c#: Public Shared Widening Operator CType(ByVal
I have some float values I want to convert to a string, I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.