Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. Qt Contribution
  4. Error in receiving the unsigned char * (image)

Error in receiving the unsigned char * (image)

Scheduled Pinned Locked Moved Qt Contribution
3 Posts 3 Posters 2.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    janaki
    wrote on last edited by
    #1

    i hve written the code like this
    @
    code
    @

    QBuffer imagebuffer;
    qint64 bytes = imagebuffer->write((const char
    ) buf,sizeof(buf)); // buf is received unsigned char*
    imagebuffer->seek(imagebuffer->pos() - bytes);
    cout<<"bytes:"<<bytes<<endl;
    QImage receivedImage;
    receivedImage.loadFromData(imagebuffer->buffer());
    if(!receivedImage.isNull()){
    qDebug() << "Image file was received ";
    }

       ui->img->setPixmap(QPixmap::fromImage(receivedImage);
    

    }

    when i execute this am getting error as
    segmentation fault

    can any body suggest me what and where is the error
    thank u

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Please enclose your code in coding tags, that will make it readable.

      As for your problem:
      You don't initialize imagebuffer

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kurt.pattyn
        wrote on last edited by
        #3

        Please ask your question on the "General and Desktop forum":http://qt-project.org/forums/viewforum/10/.
        This forum is for contributions to Qt.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved