Basically, what I'm trying to do is run a python file that will search for a string entered as an argument by creating a separate process and running a exec() function in that process, and then continuing to the next iteration ( if there is another feed to test ) as needed until returning with 0. I'm fairly sure I didn't put in this parameter of CreateProcess right :

Code:

"C:\\CProjects\rss.exe"

In this case, that would this code's application, but I wasn't sure how to set that and still be able to run the python file. Also the command line parmeter where I entered the function GetCommandLine( ) may be wrong too ( My idea was that would make sure to pass the command-line to the python program, but since that was handled in execle, it might've screwed it up anyways ). Basically, my book really goes into the full-code with Mac and just leaves Windows users like me on my own( it just suggested this function to adapt it, and that was it ). This is my first time creating processes for Windows, so I got sort of confused on the details of how to make this program work. CreateProcess fails with Unknown error in the case of my code.

Edit : Oh, and the RSS url I stored may be invalid, if you could check it or something that would be nice. Also, I just kept most of the error coding and stuff that microsoft used in their sample for Creating Processes. I just modified it a litte.

Thanks, that fixed the call to create the process, but the program basically slowed my computer down and I had to restart it after running it. My guess is that it kept calling itself recursively and creating processes. I don't know how to fix it, as I've never messed with creating processes. I ran the program with this as suggested in the book( with my few extra commands ) :

Presumably because in the book, that's where the fork() is and s/he tried to make a copy of the program like it does.

Windows doesn't have a useful equivalent to fork so perhaps the easiest way to port this is to delete all the CreateProcess specific stuff and change the execle(stuff) to _spawnle(_P_WAIT, stuff). You'll probably also have to change the path to the python executable, unless it really is installed at C:/python27.exe

Especially when the program you just run is actually C:\CProjects\rss.exe

Your analysis is correct, you have an infinite process loop.

I was trying to copy fork() in the book, but as you can see, it wasn't really going the way I might've hoped it would. I got confused on the correct module name to use, should I just make a seperate program with the loop code and keep calling that instead? That was the only solution I thought of.

Originally Posted by adeyblue

Presumably because in the book, that's where the fork() is and s/he tried to make a copy of the program like it does.

Windows doesn't have a useful equivalent to fork so perhaps the easiest way to port this is to delete all the CreateProcess specific stuff and change the execle(stuff) to _spawnle(_P_WAIT, stuff). You'll probably also have to change the path to the python executable, unless it really is installed at C:/python27.exe

Yea, I tried to do spawn from the FAQ, but I called it with my program name so I ran into the same problem. My biggest problem is me not knowing what to call so I just make my program call itself as a process, but that just creates an infinite process loop. As I said above, my only idea to fix it is to change the program I call with the loop code in a totally seperate program ( which I could manage )

Oh, and yes, I should've changed the application I ran with my exec function to this :