Not to show console window when using system()
-
As you can see in the documentation and also from the word 'file' you can also copy files with this command. You have to write a directory copy by yourself. Use the search function as you are not the first who wants to copy a directory.
@Christian-Ehrlicher
Thank you. Isee.
I found how to copy directory to another directory (including all files).
https://forum.qt.io/topic/10263/solved-copy-all-files-in-folder-to-another-directory/5 -
I created app which uses system().
the app is for windows, complier is mingw.
I found extra console windows appear for a moment when the app uses system().
How to prevent to show extra console windows? -
@ynatynat use
qDebug()
,printf()
,QProcess
etc. or some winapi methods. It's hard to say exactly what you need when we don't know what you want to achieve. What do you usesystem()
for? -
@sierdzio
Thank you for reply.
use system for:
system( "cp -pR srcFile dstFile" );
sytem( applicationName +"&")*This app was originally created for Ubuntu, but was ported to Windows.
OK then:
system( "cp -pR srcFile dstFile" );
Here you can simply use
QFile::copy()
.sytem( applicationName +"&")
Here you can use
QProcess::startDetached()
. -
OK then:
system( "cp -pR srcFile dstFile" );
Here you can simply use
QFile::copy()
.sytem( applicationName +"&")
Here you can use
QProcess::startDetached()
. -
OK then:
system( "cp -pR srcFile dstFile" );
Here you can simply use
QFile::copy()
.sytem( applicationName +"&")
Here you can use
QProcess::startDetached()
. -
@sierdzio
It seems not easy to replace system(cp ...) to QFile::copy() for windows.
It's fail to copy file or directory to directory under C:. -
@ynatynat Please show your code, it's hard to help otherwise.
Qt can definitely handle Windows paths.
@sierdzio looks like he wants to copy a directory.
-
@sierdzio looks like he wants to copy a directory.
@sierdzio
@Christian-EhrlicherQString src = "c:\Users\a\data\" std::string dst = "C:/Users/a/Documents/data_2023-11-15" QFile::copy( src , QString::fromStdString(dst));
//---------
[C:/Users/a/Documents/data_2023-11-15 ] is not found after that.
"src" is a directory, which has some files.
"dst" is a new directory. -
@sierdzio
@Christian-EhrlicherQString src = "c:\Users\a\data\" std::string dst = "C:/Users/a/Documents/data_2023-11-15" QFile::copy( src , QString::fromStdString(dst));
//---------
[C:/Users/a/Documents/data_2023-11-15 ] is not found after that.
"src" is a directory, which has some files.
"dst" is a new directory.As you can see in the documentation and also from the word 'file' you can also copy files with this command. You have to write a directory copy by yourself. Use the search function as you are not the first who wants to copy a directory.
-
As you can see in the documentation and also from the word 'file' you can also copy files with this command. You have to write a directory copy by yourself. Use the search function as you are not the first who wants to copy a directory.
@Christian-Ehrlicher
Thank you. Isee.
I found how to copy directory to another directory (including all files).
https://forum.qt.io/topic/10263/solved-copy-all-files-in-folder-to-another-directory/5 -
-
@Christian-Ehrlicher
Thank you. Isee.
I found how to copy directory to another directory (including all files).
https://forum.qt.io/topic/10263/solved-copy-all-files-in-folder-to-another-directory/5@ynatynat
Be aware that the post you link to actually removes a file hierarchy! To copy you will need to write something which is called recursively for each child directory you want to copy. There may be alternative posts which are more recent than that one. -
@ynatynat
Be aware that the post you link to actually removes a file hierarchy! To copy you will need to write something which is called recursively for each child directory you want to copy. There may be alternative posts which are more recent than that one.