LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

In Labwindows, is there an easy way to make a string control display in hexadecimal, the way Labview would allow with a right click?

In Labwindows, is there an easy way to make a string control display in hexadecimal, the way Labview would allow with a right click?
0 Kudos
Message 1 of 5
(3,570 Views)

Presumably you are actually displaying a number, so you could use a numeric instead of a string. Numerics can be set to display decimal, octal, hexadecimal formats, as desired.

JR (Hoping this is not another duplicated post...)

0 Kudos
Message 2 of 5
(3,565 Views)
Thanks.I did think of that. I'm trying to duplicate a Labview USB example that sends and receives. How would I convert the received string to hexadecimal?
0 Kudos
Message 3 of 5
(3,562 Views)
Ah - I think I'm with you now. I don't know Labview at all so I'll have another guess at what you want! Would something along the following lines be suitable:
 
    char line [100]
    char out [256];
    char segment [3];
    char *in;
    char c;
   
    out [0] = 0;                            // Ensure output line is blank
    in = line;                              // 'line' contains the received string
    while (c = *in++) {                     // Repeat until end of input string
        sprintf (segment, "%02X", c);       // Convert one character to HEX
        strcat (out, segment);              // Add it to the end of the overall string
    }
    SetCtrlVal (panel, text_control, out);  // Print the string when finished
 
JR
   
0 Kudos
Message 4 of 5
(3,560 Views)
Thanks JR, that looks like what I'm looking for.
0 Kudos
Message 5 of 5
(3,555 Views)