PDA

View Full Version : Char array[6] to QString and display it



arunvv
24th January 2008, 01:13
How can I convert a char array[6] to QString and use it for display.

Example:
char array[0] = FF,
char array[1] = FF,
char array[2] = FF,
char array[3] = FF,
char array[4] = FF,
char array[5] = FF

Use this char array, convert it to QString.
Help me out for such conversion.

Thanks & Regards,
Arun.

Gopala Krishna
24th January 2008, 04:21
How can I convert a char array[6] to QString and use it for display.

Example:
char array[0] = FF,
char array[1] = FF,
char array[2] = FF,
char array[3] = FF,
char array[4] = FF,
char array[5] = FF

Use this char array, convert it to QString.
Help me out for such conversion.

Thanks & Regards,
Arun.

I am sorry but is this c++ ? Probably you mean


char array[6];
array[0] = 0xFF,....


There is constructor for QString which constructs using "C" string.(null terminated of course)

ashukla
24th January 2008, 05:28
You can use QString::QString ( QChar ch ) and operator+=() for that. However, You are not using the correct C++ for asking problem. Which is already shown by Mr. GOPALA KRISHNA.

arunvv
24th January 2008, 17:38
Thanks for your reply.

I am using C++. So what function I need to use, if there is no function, how can i convert array of characters to QString.

Thanks & Regards,
Arun.

jpn
24th January 2008, 17:43
Did you try ...reading QString docs?

arunvv
24th January 2008, 18:52
I read QString Docs, But I don't see any thing which converts array to QString.

Please let me know how to convert it.

Thanks,
Arun

jpn
24th January 2008, 19:19
Do you know the relation between char[] and char*?

arunvv
24th January 2008, 22:19
Thanks to all it solved now.

MrShahi
10th April 2009, 12:03
char chararray [15];
QString theqstring ("This is a character array");

strcpy (chararray, theqstring.latin1());

Using this u can convert QString to char[]
:)

manoagp
17th March 2010, 08:37
hi i am a Qtforum user
i am also suffering from same problem like you
can you tell me how did you solved ur proble
plz..
i need to display hex data array(char type) in QLabel

waiting for ur reply
thanks in advance

Jayadev
12th March 2014, 05:59
Thanks to all it solved now.

Hi... Can you please tell me how you solved this issue ??? as i also need to do the same thing....

ChrisW67
12th March 2014, 20:48
What have you actually tried? What do you actually have as input? This thread contains a solution and some hints.