PDA

View Full Version : How i Get Path From Command Line Argument



METEOR7
17th November 2011, 15:46
How i Get Path From Command Line Argument

I Tested


QStringList arg=QCoreApplication::arguments();

But it,s Problem With Space on Path
Example : D:\My Files
this Splited to 2 Arguments
1=D:\My
2=Files

how i do this with out Example Problem

Thanks

mvuori
17th November 2011, 17:16
If you give your app a command line D:\My Files , why should Qt think it is one string? Obviously it is two for Qt.

Luckily it is simple: just add quotation marks around it: "D:\My Files"

METEOR7
17th November 2011, 17:35
I added quotation marks around it it
but i send multi string to my program
Example: D:\My Files*D:\
i want split When * the problem is splited when Space

Oleg
17th November 2011, 18:23
Join all arguments in one QString and then use QString::split(). Using space as separator is OS related stuff, Qt simply provide easy access to it.

METEOR7
17th November 2011, 19:12
Thanks Very Much Oleg
:o