How to write code that enters lines in the Command Arguments Section
- 
Hi 
 Do you mean something in creator that would take a text file and put first line here
  I have never seen that. 
 Also normally the app itself could read the text file for default
 parameters.
- 
Hi 
 Do you mean something in creator that would take a text file and put first line here
  I have never seen that. 
 Also normally the app itself could read the text file for default
 parameters.
- 
@lolilol78 
 hi
 Not really. its stored in the project.pro.user file so while its possible to
 change it from outside, but Creator will ignore it if already open.Why dont u just make app use those as default ? 
 so if no parameters use, the defaults.
 or make it read the text file.Im not sure i understand why u simply cant just put in Creator directly then ? 
- 
@lolilol78 
 hi
 Not really. its stored in the project.pro.user file so while its possible to
 change it from outside, but Creator will ignore it if already open.Why dont u just make app use those as default ? 
 so if no parameters use, the defaults.
 or make it read the text file.Im not sure i understand why u simply cant just put in Creator directly then ? 
- 
@lolilol78 
 but are u sure he didnt mean that APP should read text file ?
 and not Creator ?
- 
@lolilol78 
 but are u sure he didnt mean that APP should read text file ?
 and not Creator ?
- 
@mrjj 
 I created a code in exe that reads the text file and sort itbut then how can i do the connection com5 and baudrate 9600 if not typed manually inside the edit tab @lolilol78 
 hi
 well
 int main(int argc, char *argv[])
 argc is tells the number of parameters to exe
 so u can check that if any is given.
- 
@lolilol78 
 hi
 well
 int main(int argc, char *argv[])
 argc is tells the number of parameters to exe
 so u can check that if any is given.
- 
@lolilol78 
 hi
 there is not much to it.
 int argc tells the number of arguments.
 often there is one. which is the path to exe.
 so if argc is > 1 then there is (extra) parameters which are in the list
 argv
 argv is a char * array.#include <QDebug> int main(int argc, char* argv[]) { qDebug() << argv[0]; if (argc == 1 ) { qDebug() << "no params given"; } QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
- 
@lolilol78 
 hi
 there is not much to it.
 int argc tells the number of arguments.
 often there is one. which is the path to exe.
 so if argc is > 1 then there is (extra) parameters which are in the list
 argv
 argv is a char * array.#include <QDebug> int main(int argc, char* argv[]) { qDebug() << argv[0]; if (argc == 1 ) { qDebug() << "no params given"; } QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
- 
@lolilol78 
 hi
 i would tryfor (int pcount = 0; pcount < argc; ++pcount) { qDebug() << argv[pcount]; }with and without parameters in "run"/Creator else just ask. 
- 
@lolilol78 
 hi
 i would tryfor (int pcount = 0; pcount < argc; ++pcount) { qDebug() << argv[pcount]; }with and without parameters in "run"/Creator else just ask. 
- 
@mrjj thanks for the line but i didnt really understand what that means ? it is gonna print something ? @lolilol78 
 yes, it will show all parameters u give in creator / on command line when run
 it was just for u to get a feeling on how it works.
- 
@lolilol78 
 yes, it will show all parameters u give in creator / on command line when run
 it was just for u to get a feeling on how it works.
- 
@mrjj oh okay i understand thank you, but actually the parameters are stock in my text file and i need some code to go get them parameters and make the serial connection between the console and the arduino. then i dont know if it is possible.. well if if app sees that it got no parameter it could open the text file if u place it next to exe 
 yes it very possible.
 You can use QFileQFile file("comm.txt"); if(!file.open(QIODevice::ReadOnly)) { QMessageBox::information(0, "error", file.errorString()); } QTextStream in(&file); while(!in.atEnd()) { QString line = in.readLine(); // read first line qDebug() << line; // here u should set com port/ baud instead. } file.close();
- 
well if if app sees that it got no parameter it could open the text file if u place it next to exe 
 yes it very possible.
 You can use QFileQFile file("comm.txt"); if(!file.open(QIODevice::ReadOnly)) { QMessageBox::information(0, "error", file.errorString()); } QTextStream in(&file); while(!in.atEnd()) { QString line = in.readLine(); // read first line qDebug() << line; // here u should set com port/ baud instead. } file.close();
- 
@lolilol78 
 so tutor said ok to read from file?
 Note that sample read one line at a time
- 
@lolilol78 
 so tutor said ok to read from file?
 Note that sample read one line at a time
- 
@mrjj yes the fils has already been read with another function, but now : 
 how to actually send those lines one by one to Arduino via Serial Com?Hi @lolilol78 You are searching for QSerialPort 
 
