473,804 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

console.write easy peasy beginners question

I'm messing about with a console app that does some tedious data
processing, I want to show activity in the console window.

What I wanted was -
followed by \
followed by |

etc;

ie a bar revolving on the spot

console.write advances the character position by one though

Can I send a backspace through? (Have tried .write(8) .write 0x08
which is ascii BS but it keeps printing the number...)

Ta.

Oct 18 '07 #1
5 7011
On Oct 18, 11:17 am, simonl <silang...@hotm ail.comwrote:
I'm messing about with a console app that does some tedious data
processing, I want to show activity in the console window.

What I wanted was -
followed by \
followed by |

etc;

ie a bar revolving on the spot

console.write advances the character position by one though

Can I send a backspace through? (Have tried .write(8) .write 0x08
which is ascii BS but it keeps printing the number...)

Ta.
I've done the same exact thing before. It was a while ago, but I think
I moved the cursor back by using the Console.CursorL eft method.

Oct 18 '07 #2
To elaborate, before you start drawing your spinning cursor, you will
want to store the location of the cursor using the static CursorLeft and
CursorTop properties on the Console class.

After you write your character, you will want to call the static
SetCursorPositi on method on the Console class, setting the location to the
values you obtained before, and then write your character again.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<za***@construc tion-imaging.comwrot e in message
news:11******** **************@ q5g2000prf.goog legroups.com...
On Oct 18, 11:17 am, simonl <silang...@hotm ail.comwrote:
>I'm messing about with a console app that does some tedious data
processing, I want to show activity in the console window.

What I wanted was -
followed by \
followed by |

etc;

ie a bar revolving on the spot

console.writ e advances the character position by one though

Can I send a backspace through? (Have tried .write(8) .write 0x08
which is ascii BS but it keeps printing the number...)

Ta.

I've done the same exact thing before. It was a while ago, but I think
I moved the cursor back by using the Console.CursorL eft method.

Oct 18 '07 #3
"simonl" <si*******@hotm ail.comschrieb im Newsbeitrag
news:11******** **************@ e34g2000pro.goo glegroups.com.. .
>
Can I send a backspace through? (Have tried .write(8) .write 0x08
which is ascii BS but it keeps printing the number...)
You can cast a number to char. So it would be:
..Write((char)8 )

This would write a backspace to the console, though I don't know the exact
effect of this on the console. You will have to try ;)

You also can use character escapes: \b is backspace IIRC.
So '\b' means a backspace char, and "\b" would be a string with a single
backspace character.

Christof

Oct 18 '07 #4
On 18 Oct, 16:36, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
To elaborate, before you start drawing your spinning cursor, you will
want to store the location of the cursor using the static CursorLeft and
CursorTop properties on the Console class.

After you write your character, you will want to call the static
SetCursorPositi on method on the Console class, setting the location to the
values you obtained before, and then write your character again.

Luvverly, and lots more ascii graphics tools to play with too.

Oct 18 '07 #5
"Christof Nordiek" <cn@nospam.dewr ote:
You can cast a number to char. So it would be:
.Write((char)8)
This would write a backspace to the console, though I
don't know the exact effect of this on the console.
It works fine. I suppose "\b" is theoretically more portable though.

using System.Threadin g;
....
while (true) foreach (char ch in new char[] { '|', '\\', '-', '/' })
{
Console.Write(c h + "\b");
Thread.Sleep(10 0);
}

Eq.
Oct 18 '07 #6

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

Similar topics

4
3810
by: Chris Williams | last post by:
Hi... I'm trying to find some code samples that will show me how to capture non-character keypresses in a console app. I've tried the standard stuff, such as console.read and console.readline, and I've tried ConsoleEx which does a great job, but still doesn't handle non-character keys like CTRL and the arrow keys. I've read the character mode apps page on MSDN, and couldn't really make much sense out of it.
4
4962
by: baumann | last post by:
hi all, i want to use the fprintf to make log. if defined LOG_TO_FILE, it is easy to use fprintf to write the log file. if not defined LOG_TO_FILE, i want to simply write to error std console.
2
6206
by: Martín Marconcini | last post by:
Hello there, I'm writting (or trying to) a Console Application in C#. I has to be console. I remember back in the old days of Cobol (Unisys), Clipper and even Basic, I used to use a program (its name i cannot recall now...) where I designed the "screen" using this "program" and then saved it into an ASCII file. (thus, using 'extended' ASCII's like Lines, Corners, etc. and making screens look nicer and more professional). Then reading a...
2
3485
by: Michael | last post by:
Hi everybody, I want to know if there is a function in the Console to "jump" to a specific position in a Console-Output window and write something there. Another question is, if I can write with different colors in the Console (without windows-api, because I want to port the app to linux sometimes). I want to create a status-page for my Console-app, on which
2
2234
by: key9 | last post by:
Hi All I need a library which can afford "cisco" console or "juniper" console style control. (may be something like autocad's command windows) On programming running . It can afford a "SHELL" like control internal . You can type command you defined and execute the "handler".
6
5717
by: tony | last post by:
Hello! When you have windows forms you have the same possibility as when you have a Console application to use Console.Writeln to write whatever on the screen. Now to my question: Is it possible to use Console.Writeln when you have a Webservice. I don't think it's possible but just to be sure I ask you?
4
3093
by: KC | last post by:
Hi, I don't know why this question is so hard to have an answer ? I search Google for a while ... and can't find any "good" answer. Using "throw new Error(msg)" does work ... but I believe most people asking this question is try to find method similar to 'printf()' instead of exception which may stop the script.
4
3606
by: =?Utf-8?B?RG91Z0U=?= | last post by:
Some people tryed to help in my previous post. But I don't quite have it. What I want to do is send stdout to something on a form textbox, panel, listbox -- something. I want to write to a form the same way you would write to a console using console.write(), except I want to send that output to something on a form. Is this possible?
5
10783
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Dear all, I'd like to know if there is any method to minimize command mode window when a console program is running. In my case, there are several console programs which run periodically in server. Now, every console program instance will open a command mode window and they occupy the whole screen. I want to minimize all of them and maximize it if neccessary by manual. Is it possible and how to do it? I'm using VB.NET 2005. ...
0
9595
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10603
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10099
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.