I understand how important internationalization is etc. But I really need some way to convert the QString returned by getOpenFileName to a char* so I can call this function from this library I'm using.
I'm guessing that the way I'm converting the string is incorrect because the "not a map" about box triggers. However I don't know of any function that will echo back a char* C style string to me.
I tried including windows.h and saying: MessageBox(NULL, "A NORMAL STRING DAMINT", "MESSAGE", MB_OK); the way I used to do things when I coded in C. But I get "cannot convert const char* to const WCHAR*"
What the hell is a WCHAR???
void MainWindow::open() {
MPQHANDLE *MPQarchive;
tr("Starcraft maps (*.scm *.scx *.chk);;All Files (*.*)"));
if(FileString.endsWith(".scm") || FileString.endsWith(".scx")) {
if(!SFileOpenArchive((char*)FileString.data(), 1, 0, MPQarchive)) {
QMessageBox::about(this, tr
("Not a map?"), FileString
);
}
}
}
void MainWindow::open() {
MPQHANDLE *MPQarchive;
QString FileString = QFileDialog::getOpenFileName(this, tr("Open File"), "/",
tr("Starcraft maps (*.scm *.scx *.chk);;All Files (*.*)"));
if(FileString.endsWith(".scm") || FileString.endsWith(".scx")) {
if(!SFileOpenArchive((char*)FileString.data(), 1, 0, MPQarchive)) {
QMessageBox::about(this, tr("Not a map?"), FileString);
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks