freely
8th August 2011, 19:52
Hello,
When I try to create new file in directory ( that has such permissions ) on Linux it works ok but on Windows I get the errors ( file.errorString() = "The parameter is incorrect" ) , file.error = 5 ):
QFile file(outputDir_+"/"+fileName);
if (!file.open(QFile::WriteOnly))
{
QMessageBox::warning(0,"Could not create Project File",
QObject::tr( "\n Could not create Project File on disk"));
return false;
}
In Qt docs it is written that Qt 4.> automatically translates file name with path to such that contains separators for underlying system ( Linux - "/" , Windows - "\" ) and it is enought to pass to QFile constructor path with "/" separators , but when I call file.fileName() on Windows I get the "/" separators, another worlds how to create new file on windows?
Can anybody help/point what is the problem? Can anybody provide code snippet to create QFile on Windows? What to pass to QFile constructor as file name?
Thanks in advance.
When I try to create new file in directory ( that has such permissions ) on Linux it works ok but on Windows I get the errors ( file.errorString() = "The parameter is incorrect" ) , file.error = 5 ):
QFile file(outputDir_+"/"+fileName);
if (!file.open(QFile::WriteOnly))
{
QMessageBox::warning(0,"Could not create Project File",
QObject::tr( "\n Could not create Project File on disk"));
return false;
}
In Qt docs it is written that Qt 4.> automatically translates file name with path to such that contains separators for underlying system ( Linux - "/" , Windows - "\" ) and it is enought to pass to QFile constructor path with "/" separators , but when I call file.fileName() on Windows I get the "/" separators, another worlds how to create new file on windows?
Can anybody help/point what is the problem? Can anybody provide code snippet to create QFile on Windows? What to pass to QFile constructor as file name?
Thanks in advance.