Uploading of data by using System
Dear Forums,
I have a doubt regarding uploading files.......Actually what i have done is i have first listed out .xml files that are in the folder using a combobox once i select that i would be able to upload now i have a problem here please find the attachment of my code......
Code:
QString dateTimeString
= dateTime.
toString("dd-MMM-yyyy");
/////i cant have this in a string if im not wrong
////////what idea i need is how to have a string in system if not possible is there any way to send a file from device to pc as i have to bind that combo value in a string and then use in the system command
system ("/home/devkermit -is /mnt/jffs2/"+s+""+dateTimeString+".xml");
please let me know if any suggestion.......Any solution would be appreciable......Thanks in Advance.......
Regards,
Re: Uploading of data by using System
Quote:
/////i cant have this in a string if im not wrong
What string you can't have?
Quote:
////////what idea i need is how to have a string in system if not possible is there any way to send a file from device to pc as i have to bind that combo value in a string and then use in the system command
What to you mean by "device to pc".
Where is QComboBox in the code?
Is this what you want?
Code:
QString dateTimeString
= dateTime.
toString("dd-MMM-yyyy");
system ("/home/devkermit -is /mnt/jffs2/" + s + str + dateTimeString + ".xml");
Re: Uploading of data by using System
Dear Santosh,
Thanks for the reply.......Actually i jus want to know how to add how to add a string to a System command when i do so im getting the error message as "error: cannot convert 'const QString' to 'const char*' for argument '1' to 'int system(const char*)'"....Please let me know how to have a string in system so as send data from GL11 Device to pc..........Thanks in advance.....Any solution would be appreciable........
Regards,
Re: Uploading of data by using System
Here you go
Code:
QString dateTimeString
= dateTime.
toString("dd-MMM-yyyy");
const QString command
= "/home/devkermit -is /mnt/jffs2/" + s
+ str
+ dateTimeString
+ ".xml";
system(command.toStdString().c_str());
Please post such questions in Newbie forum
Re: Uploading of data by using System
Dear Santosh,
Thanks for the reply......Actually it helped me a lot and i dont think if i post in the newbie forum will get quick response so posted here.........Thanks in Advance........Any suggestion would be appreciable.......
Regards,
Re: Uploading of data by using System
Quick response does not depend on forum type, it depends on number of user online and how many of them are interested in answering your question.
What I mean is, asking such basic / C++ related questions in Standard Qt forum may get some rude answers, frankly I was about to be rude, then I realized your user name, and your earlier posts.
Re: Uploading of data by using System
Moving to Newbie. Next time please think whether a more appropriate title to your thread wouldn't have been "How to convert QString to const char*" rather than "Uploading of data using System". How you name your threads and how you state the problem has great influence on when you'll get help.
Re: Uploading of data by using System
For invoking a local command I would probably use QString::toLocal8Bit() instead of toStdString()
However, in this case I would recommend to use QProcess instead of system.
Cheers,
Kevin