Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8764869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:08:23+00:00 2026-06-13T16:08:23+00:00

I am trying to convert char* to QString . It should be a trivial

  • 0

I am trying to convert char* to QString. It should be a trivial task but the problem is, I am having the following input:

item    char [512] "N"  char [512]
    [0] 78 'N'  char
    [1] 0 '\0'  char
    [2] 73 'I'  char
    [3] 0 '\0'  char
    [4] 70 'F'  char
    [5] 0 '\0'  char
    [6] 84 'T'  char
    [7] 0 '\0'  char
    [8] 89 'Y'  char
    [9] 0 '\0'  char
    [10]    0 '\0'  char

Notice the null character after each character ‘\0’. Simply trying to convert it just yields the string “N” where as it should result into string “NIFTY”.

I am not sure if it is unicode or Ansi string (in fact I don’t know much about it). Can anyone please sort out what is going wrong here or what am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:08:24+00:00Added an answer on June 13, 2026 at 4:08 pm

    This worked for me:

        char * chr = "N\0I\0F\0T\0Y\0\0";
        QString str = QString::fromUtf16((ushort*)(chr));
        qDebug() << str;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to convert a QString to char* type by the following methods,
Trying to convert the following but am having difficulty. Can anyone see where I'm
I'm trying to convert a _bstr_t object to a char array. More specifically I've
I'm trying to use std::ostringstream to convert a number into a string (char *),
I'm trying to convert my char array to string and I get some random
Hey, I am trying to convert NSString to a C string using cStringUsingEncoding but
I am trying to convert a string ( const char* argv[] ) to a
am trying convert string to float,when i am passing single char it is giving
I'm trying to convert a char to Character before it gets pushed on a
I am trying to convert uiimage to char array to use with libtiff. Thanks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.