Results 1 to 7 of 7

Thread: Send Base64 encoded data

  1. #1
    Join Date
    Jun 2007
    Location
    italy
    Posts
    126
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Send Base64 encoded data

    Hi guys,

    I have a file in wich I store data coded in Base64.

    I want to read that data (that is I would like to put that in a buffer) and than send them
    (the buffer) via http..

    I already have a function which does the second part ..or rather it takes a buffer (char *)
    and sent it via http, so my problem is related to prepare the data itself to be sent..

    So far I tried various method to retrive this data from the file (base64 encoded) and all the time I send them, at destination I get the data with all the "+" simbol converted into a " " space.

    So I am going to ask you..

    Which is the best way to solve this problem?

    Thank yoy very much in advance.

    All the best

    Roby

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Send Base64 encoded data

    Maybe the problem is in the way you read the data... Do you read it as text or as binary?
    You should read it as binary, wit ha QDataStream.

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Send Base64 encoded data

    Btw, have you noticed QByteArray? It might be more convenient to use than char* and it also has helper methods toBase64() and fromBase64()...
    J-P Nurmi

  4. #4
    Join Date
    Jun 2007
    Location
    italy
    Posts
    126
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Send Base64 encoded data

    Can you please give me an example o what you said..because from Qt assistant I found an example but id does not work..

    Thank you

  5. #5
    Join Date
    Jun 2007
    Location
    italy
    Posts
    126
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Send Base64 encoded data

    I know, but the function I have to use takes char *

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Send Base64 encoded data

    You have QDataStream::readRawData and QByteArray::data. They both work with char arrays.

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Send Base64 encoded data

    Quote Originally Posted by rmagro View Post
    I know, but the function I have to use takes char *
    Well, you could still handle all the file reading and such with QByteArray and then simply pass QByteArray::data() to that function. Of course you can use char* if you want to. This was just a friendly suggestion.
    J-P Nurmi

Similar Threads

  1. Connect to a server, send data and exit
    By Pepe in forum Newbie
    Replies: 6
    Last Post: 27th July 2007, 11:29
  2. My client can't send data
    By hiuao in forum Qt Programming
    Replies: 10
    Last Post: 23rd February 2007, 09:32
  3. Replies: 3
    Last Post: 26th July 2006, 13:41
  4. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 12:53
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.