Hello,
I have try to find the answer, but didn't have found one. I have a small problem to write NULL character to a file, the problem is that the character is not write.
Could somebody help me ?
I have tried with QDataStream but It's add many NULL char that I don't want.
Thanks.
This is the code that I use :
return;
QRgb* rgb = (QRgb*)image.scanLine(0);
for (int x = 0; x < image.width(); x++)
{
int AlphaValue = qAlpha(rgb[x]);
int RedValue = qRed(rgb[x]);
int GreenValue = qGreen(rgb[x]);
int BlueValue = qBlue(rgb[x]);
file.write(qPrintable(AlphaAscii));
//file.write((const char *)AlphaAscii.toAscii());
}
file.close();
QFile file("out.txt");
if (!file.open(QIODevice::WriteOnly))
return;
QRgb* rgb = (QRgb*)image.scanLine(0);
for (int x = 0; x < image.width(); x++)
{
int AlphaValue = qAlpha(rgb[x]);
int RedValue = qRed(rgb[x]);
int GreenValue = qGreen(rgb[x]);
int BlueValue = qBlue(rgb[x]);
QString AlphaAscii ((QChar)AlphaValue);
file.write(qPrintable(AlphaAscii));
//file.write((const char *)AlphaAscii.toAscii());
}
file.close();
To copy to clipboard, switch view to plain text mode
Bookmarks