How to read and write a binary file in Qt?
-
I am making a cryptography algorithm and I need to read a file char by char in binary mode and then my algorithm will encrypt the char and then I have to write it in a new file. Here is the method in C:
@
while((ch=fgetc(arquivo_plano))!=EOF)
{
ch=ch^CHAVE[i];
i++ç
fputc(ch,arquivo_cifrado);
}
@[edit: added missing coding tags @ SGaist]
-
i'm sorry the implementation in C is:
@
while((ch=fgetc(arquivo_plano))!=EOF)
{
ch=ch^CHAVE[i];
i++;
fputc(ch,arquivo_cifrado);
}
@[edit: added missing coding tags @ SGaist]
-
Hi and welcome to devnet,
You can use "QFile":http://doc.qt.io/qt-5/qfile.html for that