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 7086597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:34:10+00:00 2026-05-28T07:34:10+00:00

QByteArray inArray = … ; unsigned char *in = convert1(inArray); unsigned char *out; someFunction(in,

  • 0
QByteArray inArray = " ... ";
unsigned char *in = convert1(inArray);
unsigned char *out;
someFunction(in, out);
QByteArray outArray = convert2(out);

the question is how can I correctly make these conversions (convert1 and convert2).
I cannot change someFunction(unsigned char *, unsigned char *), but I have to work with QByteArray here.

  • 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-05-28T07:34:11+00:00Added an answer on May 28, 2026 at 7:34 am

    Qt has really great docs, you should use them.

    If someFunction doesn’t modify or store pointer to in data you can use this:

    QByteArray inArray = " ... ";
    unsigned char *out;
    someFunction((unsigned char*)(inArray.data()), out);
    QByteArray outArray((char*)out);
    

    Otherwise you have to make a deep copy of the char* returned by QByteArray::data() (see the docs for code snippet).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: how to convert unsigned char array to QByteArray in Qt? How to
unsigned char x[] = {0x7E,0x00,0x00,0x0F }; I want to push it to QByteArray but
how to convert char to LPCTSTR in vc++ I am using MVC. QByteArray qBary;
Hi all I have problem with qprogressbar. How can I make it smooth? I
Any idea on how to save an array of unsigned char to a field
These 2 functions are my attempt to serialize a QVector. Unfortunally I can't use
I'm having trouble with saving a QPixmap to QByteArray, then writing it to char*.
A call to clear on a QByteArray generates the following exception: * glibc detected
I'm having trouble reading and writing QByteArray data to a file. My goal is
Is there a STL C++ class that works like QByteArray ?

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.