473,387 Members | 1,603 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.

hello world

Hi,

When writing the hello world program I insert \b in various locations
in the sentence.It works(making backspace) except when inserting
it after world\b.It dose not work.
Printf("hello, world\b")
Why?

Surena.
Nov 14 '05 #1
5 1981
su**********@yahoo.com (surena abari) writes:
When writing the hello world program I insert \b in various locations
in the sentence.It works(making backspace) except when inserting
it after world\b.It dose not work.
Printf("hello, world\b")


What actually gets displayed? This should display "hello,
world". Perhaps you are unaware of what \b is supposed to mean
for a display device:

\b (backspace) Moves the active position to the previous
position on the current line. If the active position is
at the initial position of a line, the behavior of the
display device is unspecified.
--
"When in doubt, treat ``feature'' as a pejorative.
(Think of a hundred-bladed Swiss army knife.)"
--Kernighan and Plauger, _Software Tools_
Nov 14 '05 #2
On 28 Feb 2004 12:55:53 -0800, su**********@yahoo.com (surena abari)
wrote:
Hi,

When writing the hello world program I insert \b in various locations
in the sentence.It works(making backspace) except when inserting
it after world\b.It dose not work.
Printf("hello, world\b")
Why?

What makes you think it doesn't work? What do expect to be different
with the \b in the string than without the \b? Remember, the
backspace need not be destructive.

If you are using a windows system, look very carefully at the
placement of the cursor. It should be under the d. Then remove the
\b and try again. It should be to the right of the d.
<<Remove the del for email>>
Nov 14 '05 #3
Barry Schwarz <sc******@deloz.net> wrote in message news:<c1**********@216.39.134.19>...
need not be destructive.

If you are using a windows system, look very carefully at the
placement of the cursor. It should be under the d. Then remove the
\b and try again. It should be to the right of the d.


Thanks for explaining the meaning of \b for me.
I have similar problems with other escape characters.
But I think this group it is not the proper place to
ask this questions as they are not related to C.
So would you please give me a reference(book or website)
that gives me the exact meaning of these characters?

Surena.
Nov 14 '05 #4
su**********@yahoo.com (surena abari) writes:
Thanks for explaining the meaning of \b for me.
I have similar problems with other escape characters.
But I think this group it is not the proper place to
ask this questions as they are not related to C.
So would you please give me a reference(book or website)
that gives me the exact meaning of these characters?


Here is what the C standard says about them:

2 Alphabetic escape sequences representing nongraphic characters
in the execution character set are intended to produce
actions on display devices as follows:

\a (alert) Produces an audible or visible alert without
changing the active position.

\b (backspace) Moves the active position to the previous
position on the current line. If the active position is
at the initial position of a line, the behavior of the
display device is unspecified.

\f (form feed) Moves the active position to the initial
position at the start of the next logical page.

\n (new line) Moves the active position to the initial
position of the next line.

\r (carriage return) Moves the active position to the
initial position of the current line.

\t (horizontal tab) Moves the active position to the next
horizontal tabulation position on the current line. If
the active position is at or past the last defined
horizontal tabulation position, the behavior of the
display device is unspecified.

\v (vertical tab) Moves the active position to the initial
position of the next vertical tabulation position. If
the active position is at or past the last defined
vertical tabulation position, the behavior of the
display device is unspecified.
Nov 14 '05 #5
In <5c**************************@posting.google.com > su**********@yahoo.com (surena abari) writes:
When writing the hello world program I insert \b in various locations
in the sentence.It works(making backspace) except when inserting
it after world\b.It dose not work.
Printf("hello, world\b")
Why?


You're confusing the effect of pressing the Backspace key on your console
with the effect of the ASCII BS character itself.

When you press Backspace, on a console using or emulating a glass TTY
device, the computer typically echoes back the BS, space, BS sequence,
effectively erasing the last character typed before BS. That wouldn't
be particularly effective on a real TTY device, so you'd get a different
reaction from the computer, if you made it aware that your console is
some form of serial printer.

Also beware of "orphan" CR characters, i.e. characters that were, once,
part of a CR+LF pair, but the programmer has inadvertently removed the
LF only (usually because he was unaware of the presence of the CR).
If you have such a character in the middle of a line, the output may be
different from your expectations and the reason quite elusive.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #6

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

Similar topics

24
by: Andy Sutorius | last post by:
Has anyone successfully created a Hello World program without using Visual Studio.NET? If so, what IDE did you use and what namespaces did you import? Thanks! Andy Sutorius
2
by: ME | last post by:
I am trying to find a prewritten method for converting a string like this:"Hello World" to this "Hello\sWorld". I plan to use it to build a regular expression. Specifically I am looking for a...
17
by: Tim Judd | last post by:
I must not be grasping anything here. Just a simple application, as follows (as any first-program is...) ---- #include <iostream.h> int main() { cout <<"hello world"; return 0;
6
by: RC | last post by:
Hello World, I am try do call a JavaScript function from XSLT, but I got function not avaible error. See "????" below. Would someone out there tell me how? Thank Q! <xsl:stylesheet...
8
by: vijay | last post by:
Hello, As the subject suggests, I need to print the string in the reverse order. I made the following program: # include<stdio.h> struct llnode { char *info;
4
by: arnuld | last post by:
i am learning C and doing the exercise 1-1 of K&R2, where K&R ask to remove some parts of programme and experiment with error, so here i go: #include <stdio.h> int main () { printf('hello...
0
by: C.W.Holeman II | last post by:
As K&R state the hardest part is getting a first instance to work. So I am looking for a "hello, world!" example for adding an additional element to an XHTML file. <html> <head><title>Hello,...
1
by: James T. Dennis | last post by:
You'd think that using things like gettext would be easy. Superficially it seems well documented in the Library Reference(*). However, it can be surprisingly difficult to get the external details...
11
by: cj | last post by:
Perhaps someone knows how to do this. When I open a new ASP.NET web service application in VS 2008, it opens with a simple Hello World web service already written. I want to see this work. ...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.