Decimal to Packed Decimal Conversion in C++

Discussion in 'C++' started by Ven, Jul 26, 2006.

  1. Ven

    Ven Guest

    Hi,

    I want to convert a decimal feild into a packed decimal
    field in my C++ program. How can I do that ? Is there any functions in
    C++ that can do that.

    I am using g++ compiler to compile my C++ progrmas.

    I appreciate your help.

    Thanks,
    Ven.
     
    Ven, Jul 26, 2006
    #1
    1. Advertising

  2. Ven wrote:
    > I want to convert a decimal feild into a packed decimal
    > field in my C++ program. How can I do that ? Is there any functions
    > in C++ that can do that.


    Functions? A whole library of them. I am sure you should be able to
    use some of them to achieve your goal. A single function? No single
    function for such conversion.

    > I am using g++ compiler to compile my C++ progrmas.


    Doesn't matter here. If you want a compiler-specific answer, please
    ask in the compiler-specific forum.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Jul 26, 2006
    #2
    1. Advertising

  3. Ven

    osmium Guest

    "Ven" writes:

    > I want to convert a decimal feild into a packed decimal
    > field in my C++ program. How can I do that ? Is there any functions in
    > C++ that can do that.


    The and and shift operators should be a big help in this. There is not
    function in the standard library to do that, but you could probably find a
    function on the net someplace. I think the time spent searching and
    learning to use what you find and testing the results would be better
    invested in "rolling your own". Note that BCD deals with unsigned numbers
    that have a sign attached as a separate indicator of some sort.
     
    osmium, Jul 27, 2006
    #3
  4. Ven

    Ven Guest

    Thanks, for your suggestions.

    Ven.

    osmium wrote:
    > "Ven" writes:
    >
    > > I want to convert a decimal feild into a packed decimal
    > > field in my C++ program. How can I do that ? Is there any functions in
    > > C++ that can do that.

    >
    > The and and shift operators should be a big help in this. There is not
    > function in the standard library to do that, but you could probably find a
    > function on the net someplace. I think the time spent searching and
    > learning to use what you find and testing the results would be better
    > invested in "rolling your own". Note that BCD deals with unsigned numbers
    > that have a sign attached as a separate indicator of some sort.
     
    Ven, Aug 1, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. umberto
    Replies:
    4
    Views:
    579
    umberto
    Oct 24, 2003
  2. Chris
    Replies:
    6
    Views:
    515
    Chris Uppal
    Nov 7, 2004
  3. Sameer
    Replies:
    12
    Views:
    895
    Roedy Green
    Oct 6, 2005
  4. Rick Ingham

    Packed Decimal handling library

    Rick Ingham, Sep 27, 2005, in forum: C Programming
    Replies:
    2
    Views:
    333
    Rick Ingham
    Oct 5, 2005
  5. Spufi
    Replies:
    4
    Views:
    981
    Ben Pope
    Mar 6, 2006
Loading...

Share This Page