Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

giant

Using the system() function

This topic is 5587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I am writing a GUI for my Script Engine, and am having a small problem with the system call. When the user chooses to "compile" the code, the code they have written into the GUI first needs to be saved. If the code has already been saved, the save function is called, whereas if the code has never been saved the saveas function is called. The system call is failing on weather or not I save. If I have already saved the code, the system fails. If I havent the save as dialog opens. If I enter a correct name, and then press ok, it also fails. The only time it seems to work is when the SaveAs Dialog opens and I choose cancel. When I say the system call fails, this is not entirely true, however it does not do what it is supposed to. The program that is calls is currently set to a basic program which counts up to 100000 displaying as it goes. When I say that the system call fails, what happens is that a console opens and flashes "Bad Command or File name" before disapperaing.
  
//First save the file.

//If the file has been saved already just save it

if (szFileName[0])
{
    if (PopFileWrite (hwndEdit, "temp.sag"))
    {
	bNeedSave = FALSE ;
    }
    else
    {	
	OkMessage (hwnd, "Could not write file %s", szTitleName) ;
        return 0 ;
    }
}
else
{
    //or else saveas, asking the user for a filename

    if (PopFileSaveDlg (hwnd, szFileName, szTitleName))
    {
	DoCaption (hwnd, szTitleName) ;
	
	if (PopFileWrite (hwndEdit, szFileName))
	{
	    NeedSave = FALSE ;
	}
	else
	{							    OkMessage (hwnd, "Could not write file %s", szTitleName) ;
	    return 0;
	}
    }
}
system( "ScriptEngine.exe" );
  
Above is the code. What I dont understand is that the program I am calling currently has not dependincies on weather or not I save so I cant see why it does not work when I save. If you have any ideas please let me know, cause I have been working with this for 2 days, and it is driving me crazy. Thanks Ciaran

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!