Files
pip/picodec.cpp
2011-07-29 08:17:24 +04:00

23 lines
474 B
C++

#include "picodec.h"
PIStringList PICodec::availableCodecs() {
exec("iconv", "-l");
waitForFinish();
PIString str(readOutput());
str.cutLeft(str.find("\n "));
str.replaceAll("\n", "");
return str.split("//");
}
PIByteArray PICodec::exec_iconv(const PIString & from, const PIString & to, const PIByteArray & str) {
tf.open();
tf.clear();
tf << str;
tf.close();
exec("iconv", ("-f=" + from), ("-t=" + to), tf.path());
waitForFinish();
return readOutput();
}