SML: how to clear the buffer? - sml

I am using the SML of New Jersey command window, and I want to clear the buffer from all the variables and functions. Is there any command(s) for doing it?
Thanks.

Related

Clojure CLI clear screen

Pardon me but I've just started learning clojure. I've run many commands in REPL CLI. But now I'm not able to clear the CLI screen. cls command also doesn't work inside the REPL. Thanks in advance!
Try pressing Control-l (lower case 'L' - not the number one). If the that doesn't work try starting the REPL using rlwrap, which may implement the readline support for clearing the screen. But this all depends on how you are starting the repl, and on what platform. There's no global way to clear a terminal across Windows and UNIX variants and other containers such as Emacs buffers and Atom/ProtoREPL. This isn't really something the REPL can reasonably support since the buffer is not held by the Clojure/JVM process, but by the container you're using to display it to your screen. It's also likely that your terminal emulator provides a way to clear the buffer.

Can we pass data to DLLMain before it gets hooked?

When a process from abc.cpp hooks a DLLMain, it executes the DLL_PROCESS_ATTACH. Can we pass any data or parameter to DLLMain, so that it can be used inside DLL_PROCESS_ATTACH.
As of now I am using SetProp and GetProp of window API to share data, while considering desktop window as the parent window. But I am not sure about the pros and cons of this approach.
Thanks in advance
As far as I know you can not pass a parameter when attaching. You can set an environment variable, use the registry...an INI file if you want to be old-fashioned :-)
Or, you can have a function in the DLL which is called after it is loaded, and pass the information by parameter.
If none of these solutions address your problem, please explain what you are trying to accomplish, so we can help you better.

Attach interactive console to embedded python script

I have a Python Script that I run from a C++ GUI Application.
I want to get the output of that Script into a Python Console and have the ability to manipulate them before calling another Python Function from C++.
My Question: Is that possible by just redirection stdin & stdout to Files?
Is there a better way using pure python?
Please note that I donĀ“t want to spawn the console from the C++ Programm but from outside the C++ Programm.
You should be able to adapt the approach in this answer to your needs. The example it links to uses UDP sockets for transferring commands to/from the interactive interpreter, but you could easily change that to pull data from stdin (or wherever) instead.
The key thing to take away from the example is the use of the builtin InteractiveConsole's push() method to determine whether the input is:
Well-formed Python snippet that may be evaluated as-is
A syntactically invalid snippet, or
A snippet that may become valid, but more input is needed

Need guidance in non C/C++ based graphics interface

I have prepared a program launcher in C++ (the only language I know), which accepts strings as program trigger.
But however hard I try I'm unable to give it a GUI like look; using graphics.h's graph functions creates graphics but in cmd like window.
All I need is a small widget/window like thing that sits on the desktop where a user can type the command string (and error messages can be displayed as usual).
Can I get a code snippet for such a widget/window?
The input string may be copied to a .txt file and my prog will read it from there.
P.S.- I'm a beginner & rookie so please avoid complex alternatives.
Well, one of the easiest options in my opinion is to use .NET Framework:
http://10rem.net/blog/2010/03/04/my-first-windows-cplusplus-application-in-ages-hello-world-in-win32-with-visual-cplusplus-2010
http://msdn.microsoft.com/en-us/library/bb384845.aspx

How to output in buffer console output?

How to output in buffer console output? For example I just need output of command "ipconfig -all", and want to store that information in some buffer?
You can write the output of a console application to a file (at least, in Windows), using the > parameter.
For example, for your case you'd write ipconfig -all > C:\output.txt to write the information to output.txt.
Alternatively, if you're doing it in code, you could create a process that runs ipconfig, and read the standard output using Microsoft's convoluted methods http://msdn.microsoft.com/en-us/library/ms682499%28VS.85%29.aspx, or an application framework such as Qt, which simplifies process management http://qt.nokia.com/products/ - see QProcess: http://doc.qt.nokia.com/4.3/qprocess.html#readAllStandardOutput
It seems you have an XY problem
What you really want to do is capture the output of another command. The whole "buffer" part is your first stab at an answer. It doesn't help you, and in fact it got you stuck thikning in the wrong direction.
badgerr offers some solutions, but the most common solution is popen("ifconfig -a", "r"). This doesn't return a buffer, it returns a FILE* that you can pass to fread. It's a POSIX function and available on Linux.
On Windows, you call CreateProcess and pass a STARTUPINFO structure containing dwFlags=STARTF_USESTDHANDLES, and hStdOutput=ResultOfCreatePipe.