PDA

View Full Version : qtconcurrent



knishaq
14th December 2009, 06:00
i have a list of string and want to process it such that


a) functionF will call external command qprocess:start("qconf -sq listL")
b) the output of this will be stored in /tmp/tempfile.txt
c) this file is modified and saved
d) functionG calls external comm "qconf -Mq /tmp/tempfile.txt"

step d should start only after step a b and c have completed. :)

I am presuming qtconcurrent::mappedReduced will work. How is it possible to make it work


"proc->setStandardOutputFile("/tmp/tempfile.txt") is used to set the output"

wysota
14th December 2009, 06:25
Where does the list of strings kick in exactly? By the way, Qt concurrent is not the tool for the job. QProcess is all you need.

knishaq
15th December 2009, 07:56
list of string is gotten using a qprocess::start() the output is saved in a file ( this is working )

then follows a b c d ( in fact a b c and d are working on single items, however when i go in a loop, i need to do this smoothly for each list item.)

a) for each item in the list i need to call qprocess::start("qconf -sq item[i]")
b) store the output in a temp file
c) modify the file
d) using this modified file call qprocess::start("qconf -Mq filename")


Brgds,

kNish:

wysota
15th December 2009, 08:05
Ok, so what is the problem?

knishaq
15th December 2009, 08:41
oops. The problem is when i have to do it in a loop. I mean data is written to file abrubtly because of which the step d does not happen.I know, before i ask this question, i should try with Qtemporaryfile class. is there a way to overwrite contents of a file with new. If this is solved then perhaps there is no problem in this context.


Brgds,

kNish