The backspace escape b in elixir isn't working
The backspace escape
From my experience in C
iex> IO.puts("Hello Worbldb!")
should actually return
"Hello Wol!"
With this it means that the b
actually backspaced the character that came before it.
So I tried to do this same thing in elixir and got a different output with the same.
The output is as follows
Output as per my entries
"Hello World!"
This happens the same in escaping for a new line. n
Please help.. Trying to solve a kata here.
Other characters that escape are as follows
a BEL (0x07)
b BS (0x08)
d DEL (0x7f)
e ESC (0x1b)
f FF (0x0c)
n NL (0x0a)
r CR (0x0d)
s SP (0x20)
t TAB (0x09)
v VT (0x0b)
uhhh 1–6 hex digits
xhh 2 hex digits
elixir escapestring
add a comment |
The backspace escape
From my experience in C
iex> IO.puts("Hello Worbldb!")
should actually return
"Hello Wol!"
With this it means that the b
actually backspaced the character that came before it.
So I tried to do this same thing in elixir and got a different output with the same.
The output is as follows
Output as per my entries
"Hello World!"
This happens the same in escaping for a new line. n
Please help.. Trying to solve a kata here.
Other characters that escape are as follows
a BEL (0x07)
b BS (0x08)
d DEL (0x7f)
e ESC (0x1b)
f FF (0x0c)
n NL (0x0a)
r CR (0x0d)
s SP (0x20)
t TAB (0x09)
v VT (0x0b)
uhhh 1–6 hex digits
xhh 2 hex digits
elixir escapestring
One solution would be to use regex, but I'm more interested in finding out why it doesn't work when it should.
– Sheharyar
Nov 16 '18 at 21:59
add a comment |
The backspace escape
From my experience in C
iex> IO.puts("Hello Worbldb!")
should actually return
"Hello Wol!"
With this it means that the b
actually backspaced the character that came before it.
So I tried to do this same thing in elixir and got a different output with the same.
The output is as follows
Output as per my entries
"Hello World!"
This happens the same in escaping for a new line. n
Please help.. Trying to solve a kata here.
Other characters that escape are as follows
a BEL (0x07)
b BS (0x08)
d DEL (0x7f)
e ESC (0x1b)
f FF (0x0c)
n NL (0x0a)
r CR (0x0d)
s SP (0x20)
t TAB (0x09)
v VT (0x0b)
uhhh 1–6 hex digits
xhh 2 hex digits
elixir escapestring
The backspace escape
From my experience in C
iex> IO.puts("Hello Worbldb!")
should actually return
"Hello Wol!"
With this it means that the b
actually backspaced the character that came before it.
So I tried to do this same thing in elixir and got a different output with the same.
The output is as follows
Output as per my entries
"Hello World!"
This happens the same in escaping for a new line. n
Please help.. Trying to solve a kata here.
Other characters that escape are as follows
a BEL (0x07)
b BS (0x08)
d DEL (0x7f)
e ESC (0x1b)
f FF (0x0c)
n NL (0x0a)
r CR (0x0d)
s SP (0x20)
t TAB (0x09)
v VT (0x0b)
uhhh 1–6 hex digits
xhh 2 hex digits
elixir escapestring
elixir escapestring
asked Nov 16 '18 at 21:36
Krafty CoderKrafty Coder
234
234
One solution would be to use regex, but I'm more interested in finding out why it doesn't work when it should.
– Sheharyar
Nov 16 '18 at 21:59
add a comment |
One solution would be to use regex, but I'm more interested in finding out why it doesn't work when it should.
– Sheharyar
Nov 16 '18 at 21:59
One solution would be to use regex, but I'm more interested in finding out why it doesn't work when it should.
– Sheharyar
Nov 16 '18 at 21:59
One solution would be to use regex, but I'm more interested in finding out why it doesn't work when it should.
– Sheharyar
Nov 16 '18 at 21:59
add a comment |
1 Answer
1
active
oldest
votes
Erlang console erl
, iex
, is built on the top of, plays dirty tricks with the standard input and output.
Use :stderr
to print your string, it’s untouched by erl
driver:
iex|1 ▶ IO.puts(:stderr, "Hello Worbldb!")
Hello Wol!
If you have the code in the file/project that is run with mix
or directly as elixir my_file.ex
everything will obviously work for any standard output.
Interesting that it works withstderr
as expected but notstdout
– Sheharyar
Nov 17 '18 at 10:19
I kinda explained why.
– Aleksei Matiushkin
Nov 17 '18 at 11:01
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345748%2fthe-backspace-escape-b-in-elixir-isnt-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Erlang console erl
, iex
, is built on the top of, plays dirty tricks with the standard input and output.
Use :stderr
to print your string, it’s untouched by erl
driver:
iex|1 ▶ IO.puts(:stderr, "Hello Worbldb!")
Hello Wol!
If you have the code in the file/project that is run with mix
or directly as elixir my_file.ex
everything will obviously work for any standard output.
Interesting that it works withstderr
as expected but notstdout
– Sheharyar
Nov 17 '18 at 10:19
I kinda explained why.
– Aleksei Matiushkin
Nov 17 '18 at 11:01
add a comment |
Erlang console erl
, iex
, is built on the top of, plays dirty tricks with the standard input and output.
Use :stderr
to print your string, it’s untouched by erl
driver:
iex|1 ▶ IO.puts(:stderr, "Hello Worbldb!")
Hello Wol!
If you have the code in the file/project that is run with mix
or directly as elixir my_file.ex
everything will obviously work for any standard output.
Interesting that it works withstderr
as expected but notstdout
– Sheharyar
Nov 17 '18 at 10:19
I kinda explained why.
– Aleksei Matiushkin
Nov 17 '18 at 11:01
add a comment |
Erlang console erl
, iex
, is built on the top of, plays dirty tricks with the standard input and output.
Use :stderr
to print your string, it’s untouched by erl
driver:
iex|1 ▶ IO.puts(:stderr, "Hello Worbldb!")
Hello Wol!
If you have the code in the file/project that is run with mix
or directly as elixir my_file.ex
everything will obviously work for any standard output.
Erlang console erl
, iex
, is built on the top of, plays dirty tricks with the standard input and output.
Use :stderr
to print your string, it’s untouched by erl
driver:
iex|1 ▶ IO.puts(:stderr, "Hello Worbldb!")
Hello Wol!
If you have the code in the file/project that is run with mix
or directly as elixir my_file.ex
everything will obviously work for any standard output.
edited Nov 17 '18 at 6:45
answered Nov 17 '18 at 6:06
Aleksei MatiushkinAleksei Matiushkin
81k95491
81k95491
Interesting that it works withstderr
as expected but notstdout
– Sheharyar
Nov 17 '18 at 10:19
I kinda explained why.
– Aleksei Matiushkin
Nov 17 '18 at 11:01
add a comment |
Interesting that it works withstderr
as expected but notstdout
– Sheharyar
Nov 17 '18 at 10:19
I kinda explained why.
– Aleksei Matiushkin
Nov 17 '18 at 11:01
Interesting that it works with
stderr
as expected but not stdout
– Sheharyar
Nov 17 '18 at 10:19
Interesting that it works with
stderr
as expected but not stdout
– Sheharyar
Nov 17 '18 at 10:19
I kinda explained why.
– Aleksei Matiushkin
Nov 17 '18 at 11:01
I kinda explained why.
– Aleksei Matiushkin
Nov 17 '18 at 11:01
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345748%2fthe-backspace-escape-b-in-elixir-isnt-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
One solution would be to use regex, but I'm more interested in finding out why it doesn't work when it should.
– Sheharyar
Nov 16 '18 at 21:59