473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do you clear screen or execute an OS level task

Sam
Sorry one of those "C" type transistion questions which I
could find no answer for in existing C# text books.

In C, I used to use the system function call to execute
programs synchronously.

To clear the screen, for console based programs, I used
to include the following statement in my program.

system("cls"); // For DOS/windows based programs
system("clear"); // for UNIX based programs

So does anyone know :

1. The .NET library equivalent to the old system function
call.

2. How to clear the screen for console based programs.

Thanks
Nov 15 '05 #1
2 1819
Sam,

If you want to do this, then you will have to create a DLL which exports
a function which will pass the command you want to the system call. I
believe that system was part of the C runtime, which is a library and can't
be accessed through .NET directly.

However, you should probably use one of the console functions in
kernel32.dll, as they would be easier to import into your program through
the P/Invoke layer.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Sam" <sc******@sbcglobal.net> wrote in message
news:21****************************@phx.gbl...
Sorry one of those "C" type transistion questions which I
could find no answer for in existing C# text books.

In C, I used to use the system function call to execute
programs synchronously.

To clear the screen, for console based programs, I used
to include the following statement in my program.

system("cls"); // For DOS/windows based programs
system("clear"); // for UNIX based programs

So does anyone know :

1. The .NET library equivalent to the old system function
call.

2. How to clear the screen for console based programs.

Thanks

Nov 15 '05 #2
Hi Sam,

Take a look at this article, and post back your results cause I will use it
soon ;)
http://support.microsoft.com/default...b;en-us;319239
it's written in VB but it should be easy to translate to C#

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Sam" <sc******@sbcglobal.net> wrote in message
news:21****************************@phx.gbl...
Sorry one of those "C" type transistion questions which I
could find no answer for in existing C# text books.

In C, I used to use the system function call to execute
programs synchronously.

To clear the screen, for console based programs, I used
to include the following statement in my program.

system("cls"); // For DOS/windows based programs
system("clear"); // for UNIX based programs

So does anyone know :

1. The .NET library equivalent to the old system function
call.

2. How to clear the screen for console based programs.

Thanks

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: NeoPhreak | last post by:
How would you clearn the screen in a console program??? Thanks NeoPhreak >.<
19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
6
by: Maxd out | last post by:
Hi I'm wondering if you can clear a monitor display cout that asks for something after it's been read in by cin e.g; cout <<"Enter number" <<endl; If so how can it be done?
2
by: Tomomichi Amano | last post by:
Hello How can I delete (clear) lines that were made useing Graphics.DrawLine() ? Thanks in advance! Have a nice day!
1
by: linuxnooby | last post by:
Hi I am trying to write a python script to run on windows xp that will have a full screen gui. The script has a function that creates a full screen (hides task bar) top level window using...
3
by: revansx | last post by:
Folks, I aplogize for posting a second time. I am surprised at what little has be said about this issue. Is there another list that I should post this to?...
22
by: mp | last post by:
i have a python program which attempts to call 'cls' but fails: sh: line 1: cls: command not found i tried creating an alias from cls to clear in .profile, .cshrc, and /etc/profile, but none...
2
by: nickyeng | last post by:
i have a function that clear the screen and then display array to cout. i compiled no error no warning, i run it, the screen really get "clear" but it does not display anything to cout, and it...
0
by: amitp | last post by:
Hello, I've a DTS Package in which i'm using Execute SQL Task. It's having a connection CON1. I've a function which is defined at DataBase level CON2. The query in the Execute SQL Task is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.