Your code looks fairly alien to me because I don't do QT. However, I looked up QString to see what it was and it appears to be some sort of QT String Class. That being the case, it seems likely to me that the address of a QString object (which isn't a pointer to a character string, but rather a pointer to a container which contains a pointer to a string), which is what you are passing to URLDownloadToFile in the 2nd parameter, isn't the pointer to a string that the function wants. I realize that's about as clear as mud! Think of it this way, if you were using wstring::c_str() you would be passing the address of the string that the function wants.
I just briefly looked at QString xMario; enough though to see it had a lot of member functions as is typical of any String Class. Actually, I have my own String Class which I wrote many years ago and use in lieu of the C++ Std. Lib. String Class. But to answer your question you need to research the QString Class to determine which member returns a wchar_t* to the underlying character string controlled by the String object. Naturally, QString::c_str() won't work because that is the name of the member function of the std::string and std::wstring classes which return a pointer to the character string controlled by the class. In my string class my member that does that is named String::lpStr(). So you need to read through all the member function names to find which member returns a wchar_t* to the string controlled by the class. That is the only type of object/parameter URLDownloadToFile() will take. Hope I've explained it OK. Good luck!
char *qtToCString(QString &str)
{
int length = str.length();
char *str = newchar[length + 1];
for (int i = 0; i < length; ++i)
{
str[i] = str.at(i).toAscii();
}
str[length] = 0;
return str;
}
Explaination for the function:
The function I provided will let you pass in a Qt string by reference and then extracts each of its characters. As each character is extracted, it is placed into the "c" string.
You can use this string (char* type) for URLDownloadToFileA specified by coder777. You might need to cast the result of "qtToCString" to a const char* to use URLDownloadToFileA though.
Edit:
It looks like you could also take the qt string and do something like: qstring.toAscii().data();