実際に Qt で QString を使用しています。簡単な機能があれば教えてください:)
私が考えているのは、バイナリ文字列をバイト単位でファイルに格納することです。
QString code = "0110010101010100111010 /*...still lots of 0s & 1s here..*/";
ofstream out(/*...init the out file here...*/);
for(; code.length() / 8 > 0; code.remove(0, 8)) //a byte is 8 bits
{
BYTE b = QStringToByte(/*...the first 8 bits of the code left...*/);
out.write((char *)(&b), 1);
}
/*...deal with the rest less than 8 bits here...*/
QStringToByte() 関数をどのように記述すればよいですか?
BYTE QStringToByte(QString s) //s is 8 bits
{
//?????
}
お返事ありがとうございます。