开发者

changing textstream type in Qt

开发者 https://www.devze.com 2023-03-24 01:34 出处:网络
I have a small problem. i have written a code in Qt that will create an application which will take contents from a file encrypt it and save the encrypted contents to another file. now i have written

I have a small problem. i have written a code in Qt that will create an application which will take contents from a file encrypt it and save the encrypted contents to another file. now i have written another code as well which take contents from a file and decrypt and save the decrypted contents to another file. now when i did that my decryption results weren't correct. my algorithms are definitely correct. the problem is i guess with the text encoding format. because when i encrypted a particular text in another app an开发者_运维百科d it displayed the encrypted contents in a lineEdit. i copied and pasted the same contents in a notepad file as unicode format. then i executed my decryption application. it gave me correct resulrs., so please help me.


Assuming your encryption create binary data from text data and is not just text only, you probably want to use a QDataStream for writing and reading the encrypted data, it handles writing chunks of bytes, e.g. QByteArray correctly without translation. If you used a QTextStream that probably won't work

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号