Thread: formatting of string

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    1

    Question formatting of string

    Hello ,

    i have tried a hell lot no of ways to do this, but all in vain.
    let me tell what exactly i want to do .
    I have a function int reportError(char *errorFormatString,

    unsigned char *GT1_p,

    unsigned int GT1_length,

    unsigned char *GT2_p,

    unsigned int GT2_length)
    During execution , using gdb i can see its arguments values as :

    reportError (errorFormatString=0x2b5d309c4140 "Failed to extract
    NDC from GT %s to prefix %s",
    GT1_p=0x612b5e "Dy\003\t2\020ÿÿ\a", GT1_length=8,
    GT2_p=0x7fff8d26f030 "I\231\020", GT2_length=9)

    Using gdb i can see
    Value at GT2 address ie GT2_p

    (gdb) x /3 0x7fff8d26f030
    0x7fff8d26f030: 0x00109949 0x40302200 0x1f78d30f
    So it shows the value is 49991000002230400f (byte swapped and lenght
    is 9 ie 18 bytes or 18 characters)

    Value at GT1 address ie GT1_p
    (gdb) x /3 0x612b5e
    0x612b5e: 0x09037944 0xffff1032 0x00000007
    So it shows the value is 447903093210ffff (byte swapped and lenght
    is 8 ie 16 bytes or 16 characters)

    I want to store GT2 value 49991000002230400f and GT1 value
    447903093210f in errorFormatString .
    as below
    "Failed to extract NDC from GT 447903093210 to prefix
    49991000002230400f "

    Can somebody suggest a way to do this .

    Thanks in Advance.

    Aki

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Use %x or %p format?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please check my C++
    By csonx_p in forum C++ Programming
    Replies: 263
    Last Post: 07-24-2008, 09:20 AM
  2. String Class
    By BKurosawa in forum C++ Programming
    Replies: 117
    Last Post: 08-09-2007, 01:02 AM
  3. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  4. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM