Convert application/octet-stream file to text/plain



  • Hello,
    I want to convert application/octet-stream file to text/plain.There are many web sites which can convert files into different formats on the web. Also I can convert my file through a web application but I want to do it in QT. There is a QMimeType and QMimeDatabase libraries and by the help of the libraries I can learn type of my file. But how to convert ? Thank you in advance.


  • Moderators

    @aysenur
    At least to me, it's completely unclear what you are trying to do.
    The mime-type application/octet-stream is actually applicable for any file type since it only represents a binary data stream. So you can convert it to any file type actually. So what are you trying to to do?!


  • Lifetime Qt Champion

    Hi,

    What conversions do you have in mind ? There's no magic wand transforming the PowerPoint document you download into a video file.



  • I want to convert my binary stl file to Ascii stl file(which is in plan/text format) to read it from qt and display on the screen. When I checked the properties of the files, which qt code reads, are ascii stl files but the stl files which are scanned from our 3d scanner is in application/octet-stream. I thought that when I change the mimetype of the file I can convert but this is wrong. I need to do more I think. Thank you.


  • Moderators

    @aysenur
    so you are getting application/octet-stream from querying QMimeDatabase? If so this just means that there couldn't be a related mime-type found.

    So you want to convert a binary STL file to a ASCII-STL file and also render it's 3D model? Well this requires that you fully understand the binary structure of binary STL files in order to do the proper conversation and the proper interpretation.

    You are better off searching for a C/C++ library which does the work for you. Alternatively you may want to use a webservice to do so in your application.

    But i think i am not going too far when i say that doing this all on your own is illusionary, when you already asked this question.



  • @raven-worx Thank you for your reply. There are codes for reading stl files on github. I am not doing all staff by myself. But the files should be in plain/text format. Because when I open the stl file which is in octet stream has mixed characters. In the code for reading the triangle positions there are some beginnings and endings but in binary format there is not. Your web service offer is good I will search it and I will search for c++ .



  • @aysenur Have you read any documentation about the binary and ASCII formats for STL files? i.e. this wikipedia entry may help.

    And this Ruby program may help as well in the conversion process itself, being that you run the script as an external process with QProcess, or by reading the Ruby code and writing the equivalent corresponding C++ code (at least initially you'll only needs just one part, binary to ASCII)



  • @Pablo-J.-Rogina Thank you. I will check ruby program.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.