Click here to Skip to main content
15,845,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey guys,

i have finnished my programming language, this time it reads from a file and uses the args[0] thingy, but i want to make an IDE(i think it is called) for it. What it is meant to do is you open the program, you type in all the code into a textbox and then you press a run button or something like that and it open up a .exe file called 'H3LTON'(my programming language name) and it then sends the code from the TextBox to it as the args[0] so that it can run it. is this possible? if so, how can i do it? can you please give me a code example?
Posted

It all really depends what your H3LTON executable does.

  1. Is it something that runs commands interactlively like a python shell? If that should be the case I'd work it so that the System.Diagnostic.Process is run with input stream redirection. The input stream would then be a System.IO.StreamReader[^] that would be fed from the string content of your TextBox.
  2. If your executable can read a program from a file. Just write the content of the TextBox to a file and call your H3LTON executable with the filename as the parameter.
  3. If you can specify commands directly as a command line parameter you can also do that, but you should know that the total length of the command line is limited. I'm not quite sure where that limit is right now, but there is one which might cripple the functionality of your setup if somebody entered a real big program into that TextBox.


So which ever method you choose you should be aware of what exactly you are trying to achieve and the benefits and drawbacks of each solution. Saving the code into an intermediate file with a constantly changing temporary filename has the advantage that all the programs a user entered will not be lost until the temporary storage space is cleard. This could be considered a feature :).

Regards,

Manfred
 
Share this answer
 
v2
Here is a Stack Overflow question that has the answer to your question:

http://stackoverflow.com/questions/2593313/how-to-execute-console-application-from-windows-form[^]

Basically, you use the System.Diagnostics.Process.Start method to call your app and pass in the parameters you want.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900