PN: Support for common functions not in Ansi Standards

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Nolan

    PN: Support for common functions not in Ansi Standards

    Hi All,
    I am testing some VC++ code from win2000 on a Solaris machine.

    I've found a couple of functions that are in VC++ but not the sun
    compiler. The two so far are:

    itoa - Integer to asci string
    fcvt - Floating point to ascii string (at least I think this will be
    missing as I have not tested it yet.)

    I was wondering if there was any public functions written in C that I
    could use to give the same functionality as in VC++?

    I am guessing these routines are so common that someone must have
    written and published some common functions.

    (I have used sprintf to emulate itoa on base10 numbers...)

    Thanks
    Peter Nolan

  • Rolf Magnus

    #2
    Re: PN: Support for common functions not in Ansi Standards

    Peter Nolan wrote:
    [color=blue]
    > Hi All,
    > I am testing some VC++ code from win2000 on a Solaris machine.
    >
    > I've found a couple of functions that are in VC++ but not the sun
    > compiler. The two so far are:
    >
    > itoa - Integer to asci string
    > fcvt - Floating point to ascii string (at least I think this will be
    > missing as I have not tested it yet.)
    >
    > I was wondering if there was any public functions written in C that I
    > could use to give the same functionality as in VC++?
    >
    > I am guessing these routines are so common that someone must have
    > written and published some common functions.
    >
    > (I have used sprintf to emulate itoa on base10 numbers...)[/color]

    You should use a stringstream. It provides the requested operations.
    However, it doesn't do arbitrary bases, but only 10 and 16 (and maybe
    2) AFAIK. Can't sprintf do that, too?


    Comment

    • lilburne

      #3
      Re: PN: Support for common functions not in Ansi Standards



      Peter Nolan wrote:
      [color=blue]
      > Hi All,
      > I am testing some VC++ code from win2000 on a Solaris machine.
      >
      > I've found a couple of functions that are in VC++ but not the sun
      > compiler. The two so far are:
      >
      > itoa - Integer to asci string
      > fcvt - Floating point to ascii string (at least I think this will be
      > missing as I have not tested it yet.)
      >
      > I was wondering if there was any public functions written in C that I
      > could use to give the same functionality as in VC++?
      >[/color]

      Check up on strstreambuf and the manipulators oct, dec, and hex.

      Comment

      Working...