Ziqian Xie
Ziqian Xie

Reputation: 145

How to do system call in MFC?

It is a really old MFC program which I have to use right now. Some calculation needs to be done and I already have a python script written for that, writing things again in c++ is too time consuming, so I made MFC output data in text file, then try to use system() to call python (as system("python XXX.py")) and write the result back in another text file. But when the MFC program ran to that part, the command window popped up briefly but no text file was generated. I tested system("python XXX.py") in a separated c++ project and it worked fine, so it must be a MFC problem, I have googled and tried using _spawnl(), but it is not working. Needs help, thanks in advance.

Upvotes: 1

Views: 1196

Answers (1)

MSalters
MSalters

Reputation: 180010

No, it's not an MFC problem. system() in both cases is the same C library function.

However, note that XXX.py is a filename without path. Your problem might simply be that the file isn't found.

Upvotes: 1

Related Questions