Shashank <firstname.lastname@example.org> wrote:
I am spawning the “cp” command from a photon application to copy files from
the hard drive to floppy. Even if there is no space left on the floppy
Ptspawn returns successfully. Is there a way to pop up an error message if
there is no space left?
PtSpawn() returning success means that the program cp was successfully
loaded and started executing as a process.
From looking at the docs, if you also add a callback function for
PtSpawn, this gets passed a status field. It isn’t clear, but I
would be that this is the same status that waitpid() gives, and
then you can apply the WIFEXITED() and WEXITSATUS() macros to it
to determine if cp exited normally, and if so, whether it returned
an error or success.
It will return 0 on success, and > 0 if an error occurred – but
doing it this way, it is difficult to find out what error occurred.
If you wish to do it in a slightly less Photon-ish way, you might
think about doing a popen() on cp, and looking at the status of
its exit, and any messages it might print out – and either parsing
the messages or just displaying them directly in a text field.
QNX Training Services
Please followup in this newsgroup if you have further questions.