Screen Dump Problems

I am trying to implement a controlled screen dump function in a user
interface application, QNX4.25 Photon 1.14. I have tried many different
approaches but can’t get any of them to work correctly, they all fail in the
same way.

I have set up the BMP spool file and if I run snapshot from a console
everything is fine and can be repeated as necessary.

When I try to run snapshot from my application, using the system() command,
the following happens …

If no bitmap file exists in the working directory everything is fine

next time through, when there’s an existing file (different file name) my
app SIGSEGV’s in an event handler routine
ApEventHandler …

I have tried PtSpawn, spawnl, qnx_spawn … all fail in the same way.

Anyone had any experienceof this ? All I want to do is have a button on the
screen to capture the display