| 6662 | |
| 6663 | #ifdef Q_OS_WIN |
| 6664 | TCHAR* CharToWchar(const QString& str) |
| 6665 | { |
| 6666 | QByteArray ba = str.toUtf8(); |
| 6667 | char* data = ba.data(); //以上两步不能直接简化为“char *data = str.toUtf8().data();” |
| 6668 | int charLen = strlen(data); |
| 6669 | int len = MultiByteToWideChar(CP_ACP, 0, data, charLen, NULL, 0); |
| 6670 | TCHAR* buf = new TCHAR[len + 1]; |
| 6671 | MultiByteToWideChar(CP_ACP, 0, data, charLen, buf, len); |
| 6672 | buf[len] = '\0'; |
| 6673 | return buf; |
| 6674 | } |
| 6675 | #endif |
| 6676 | |
| 6677 | void CCNotePad::tailfile(bool isOn, ScintillaEditView* pEdit) |