locked
Sir/Madam, Could you please help me in debugging "printf("s\n,...)" prints dupliated strings ? RRS feed

  • Question

  • Sir/Madam, Could you please help me in debugging "printf("s\n,...)" prints dupliated strings ?

    Sincerely,

    Liu Wang

    Code segment:

    ----------------------------------------

        printf( "\n%3s", &testVPD[ 0 ] );                                                     //        3         253        - PN:
        printf( "%24s\n", &testVPD[ 0x03 ] );                                             //        24        229        - example: "AOC-SLG2-2TM2-T"
        printf( "%3s", &testVPD[ 0x20 ] );                                                  //        3         221        - VP:
        printf( "%-5s\n", &testVPD[ 0x23 ] );                                              //        8         213        - example: "1.01A"
        printf( "%3s", &testVPD[ 0x30 ] );                                                   //        3         189        - SN:

        printf( "%-24s\n", &testVPD[ 0x33 ] );                                             //        24        165       - example "HA184S002052"
        printf( "%3s", &testVPD[ 0x60 ] );                                                   //        3         141        - FW:
        printf( "%-21s\n", &testVPD[ 0x63 ] );                                             //        29        112      -
        printf( "Date in YYYYMMDD : %-4s\n", &testVPD[ 0x80 ] );               //        8         104        - YYYYMMDD
        printf( "Time in HHMMSS   : %-8s\n", &testVPD[ 0x88 ] );                //        8          96        - HHMMSS
        printf( "Batch            : %-8s\n", &testVPD[ 0x90 ] );                        //        8          88        - example "0003"
        printf( "Controller       : %24s\n", &testVPD[ 0xa0 ] );                      //        24        56      
        printf( "EndTag           : %1s\n", &testVPD[ 0xfe ] );                         //        1           1        
        printf( "CheckSum         : 0x%2x\n", ( unsigned char )&testVPD[ 0xff ] ); //        1           0        

    -------------------------------------------------------------------------------------------------------

    Output:

    ----------------------------------------------------------------------

    PN:AOC-SLG2-2TM2-T         AOC-SLG2-2TM2-T
    VP:1.01A1.01A
    SN:123456789012345678901234123456789012345678901234
    FW:2.3.21.1000_(SMC_M.2)2.3.21.1000_(SMC_M.2)
    Date in YYYYMMDD : 20181131112747
    Time in HHMMSS   : 112747
    Batch            : 0003
    Controller       : 88SE9230A1-NAA2C000-W572
    EndTag           :
    CheckSum         : 0x5f
    checkSumVerify   : 0
    -----------------------------------------------------------------------------------------

    Data in testVPD array:

    -------------------------------------------------------------

    PN:AOC-SLG2-2TM

    2-T.............

    VP:1.01A........

    SN:1234567890123

    45678901234.....

    FW:2.3.21.1000_(

    SMC_M.2)........

    20181129123421..

    0003............

    88SE9230A1-NAA2C

    000-W572@




    Wednesday, December 5, 2018 11:32 PM

All replies