LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

textbox problem

we created a textbox which should contain the following:

" wert = [int] : [char] "

How can we put in an integer, though the textbox only excepts a character or pointer to char?
And how can we manage to combine a character and an integer to a string?

Hope, someone can help us ...

Thanks.
0 Kudos
Message 1 of 4
(2,882 Views)
You can use the standard ANSI C function sprintf to format and append any data type into a string. Something like:

char buffer[100];
int number = 5;
char character = 'a';


sprintf(buffer, "wert = %d:%a", number, character);

That would give you a string in buffer that reads "wert = 5:a".

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(2,882 Views)
minor correction:

sprintf(buffer, "wert = %d:%c", number, character);

but Im just being picky

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 3 of 4
(2,882 Views)
Try this:

char line[100], your_char_variable;
int your_int_variable;

sprintf(line," wert=[%d] : [%c]",your_int_variable,your_char_variable);
ResetTextbox(panel,txtctrlid,"line");



"m_schulze" wrote in message
news:50650000000800000044580000-1027480788000@exchange.ni.com...
> we created a textbox which should contain the following:
>
> " wert = [int] : [char] "
>
> How can we put in an integer, though the textbox only excepts a
> character or pointer to char?
> And how can we manage to combine a character and an integer to a
> string?
>
> Hope, someone can help us ...
>
> Thanks.
0 Kudos
Message 4 of 4
(2,882 Views)