On Tuesday 15 March 2011 22:05:37 Ali Çehreli wrote:
I am going over some sample programs in a text of mine and replacing
std.cstream references with std.stdio. There are non-trivial differences
with formatted input.
The following program may be surprising to the novice:
import std.stdio;
On 03/16/2011 06:05 AM, Ali Çehreli wrote:
I am going over some sample programs in a text of mine and replacing
std.cstream references with std.stdio. There are non-trivial differences with
formatted input.
The following program may be surprising to the novice:
import std.stdio;
void main()
{
On 03/16/2011 06:41 AM, Jesse Phillips wrote:
Ali Çehreli Wrote:
Right? Is there a better way that I am missing?
Thank you,
Ali
No better way, the stated reason IIRC is that it is easier to remove the new
line then to append it back on.
May be stated, but it is very wrong! I guess:
On Wed, 16 Mar 2011 11:20:43 +0100, spir wrote:
On 03/16/2011 06:41 AM, Jesse Phillips wrote:
Ali Çehreli Wrote:
Right? Is there a better way that I am missing?
Thank you,
Ali
No better way, the stated reason IIRC is that it is easier to remove
the new line then to append it back on.
Ali ǥhreli Wrote:
The following program may be surprising to the novice:
import std.stdio;
void main()
{
write(What is your name? );
string name = readln();
writeln(Hi , name, !);
}
What if the user typed leading spaces? Will the program operate as you expect?
On 03/16/2011 05:49 AM, Kagamin wrote:
Ali ǥhreli Wrote:
The following program may be surprising to the novice:
import std.stdio;
void main()
{
write(What is your name? );
string name = readln();
writeln(Hi , name, !);
}
What if the user typed leading spaces? Will the
spir Wrote:
On 03/16/2011 06:41 AM, Jesse Phillips wrote:
Ali Ãehreli Wrote:
Right? Is there a better way that I am missing?
Thank you,
Ali
No better way, the stated reason IIRC is that it is easier to remove the
new line then to append it back on.
May be stated, but it is
Ali Ãehreli Wrote:
I don't have a problem with whitespace being left in the line, I just
want to know whether that's the intended or accepted behavior.
AFAIK, it is. It was intended to preserve eols while reading and writing lines.
On 03/16/2011 07:54 AM, Ali Çehreli wrote:
On 03/16/2011 05:49 AM, Kagamin wrote:
Ali ǥhreli Wrote:
The following program may be surprising to the novice:
import std.stdio;
void main()
{
write(What is your name? );
string name = readln();
writeln(Hi , name, !);
}
What if the user typed
Kai Meyer Wrote:
Second, D doesn't seem to have a graceful way of reading an endless
stream of your favorite data type delimited by your favorite
delimiting character. I think readf is rigid, and works great in some
cases. I would greatly appreciate something more flexible like C++'s
I'm having some problems understanding the (complex) is expression.
// Example from the documentation
static if (is(int[10] X : X[Y], int Y : 5))
{
assert(0); // should not match, Y should be 10
}
// but this doesn't match either.. Shouldn't it?
static if (is(int[10] X : X[Y],
http://www.digitalmars.com/d/2.0/tuple.html
// this example fails
Tuple!(3, 7, 'c')
typecons.d(298): Error: static assert Attempted to instantiate Tuple
with an invalid argument: 3
Even this fails:
alias Tuple!(0) T;
Is Tuple only meant to store types or named types?
On Wed, 16 Mar 2011 21:07:08 +0100, simendsjo simen.end...@pandavre.com
wrote:
http://www.digitalmars.com/d/2.0/tuple.html
// this example fails
Tuple!(3, 7, 'c')
typecons.d(298): Error: static assert Attempted to instantiate Tuple
with an invalid argument: 3
Even this fails:
alias
On Wed, 16 Mar 2011 16:28:48 -0400, Simen kjaeraas
simen.kja...@gmail.com wrote:
On Wed, 16 Mar 2011 21:07:08 +0100, simendsjo
simen.end...@pandavre.com wrote:
http://www.digitalmars.com/d/2.0/tuple.html
// this example fails
Tuple!(3, 7, 'c')
typecons.d(298): Error: static assert
Am 16.03.2011 11:09, schrieb spir:
This is a design bug. 99% of the time one does not want the newline,
which is not part of the string data, instead just a terminator. Even
more on stdin where it is used by the user to say Im done!.
If the text is written back to the output /and/ newline is
Is it possible to declare string literal of a template type, something
like this:
void bar (const(T)[] a) {}
void foo (T) (const(T)[] a)
{
bar(abcT);
}
foo(defw);
In this case the string literal passed to bar would be of the type
wstring.
Is this somehow possible or do I have to
On Wed, 16 Mar 2011 21:51:37 +0100, Steven Schveighoffer
schvei...@yahoo.com wrote:
On Wed, 16 Mar 2011 16:28:48 -0400, Simen kjaeraas
simen.kja...@gmail.com wrote:
On Wed, 16 Mar 2011 21:07:08 +0100, simendsjo
simen.end...@pandavre.com wrote:
On Thu, 17 Mar 2011 00:30:17 +0300, Jacob Carlborg d...@me.com wrote:
Is it possible to declare string literal of a template type, something
like this:
void bar (const(T)[] a) {}
void foo (T) (const(T)[] a)
{
bar(abcT);
}
foo(defw);
In this case the string literal passed to bar would
On Wed, 16 Mar 2011 22:39:00 +0100, Denis Koroskin 2kor...@gmail.com
wrote:
On Thu, 17 Mar 2011 00:30:17 +0300, Jacob Carlborg d...@me.com wrote:
Is it possible to declare string literal of a template type, something
like this:
void bar (const(T)[] a) {}
void foo (T) (const(T)[] a)
{
On Wed, 16 Mar 2011 17:31:06 -0400, Simen kjaeraas
simen.kja...@gmail.com wrote:
On Wed, 16 Mar 2011 21:51:37 +0100, Steven Schveighoffer
schvei...@yahoo.com wrote:
On Wed, 16 Mar 2011 16:28:48 -0400, Simen kjaeraas
simen.kja...@gmail.com wrote:
On Wed, 16 Mar 2011 21:07:08 +0100,
On Wednesday, March 16, 2011 14:43:20 Steven Schveighoffer wrote:
On Wed, 16 Mar 2011 17:31:06 -0400, Simen kjaeraas
simen.kja...@gmail.com wrote:
On Wed, 16 Mar 2011 21:51:37 +0100, Steven Schveighoffer
schvei...@yahoo.com wrote:
On Wed, 16 Mar 2011 16:28:48 -0400, Simen kjaeraas
On Wed, 16 Mar 2011 22:43:20 +0100, Steven Schveighoffer
schvei...@yahoo.com wrote:
Now I am concerned, this looks like an oxymoron:
TypeTuple!(1, 2, 3)
Should we think about changing the name of std.typetuple.TypeTuple since
it can clearly contain expressions as well as types? I would
I have a D2 code that writes some stuff to the screen (usually runs in
cmd.exe pseudo-console). When I print spanish characters they show wrong
(gibberish symbols and so, wich corresponds to CP-1252 encoding).
Is there a way to convert all outputted streams to CP-1252 without
having to wrap
import std.c.windows.windows;
extern(Windows) BOOL SetConsoleOutputCP(UINT);
SetConsoleOutputCP(65001);
Otherwise you might be interested in using the WinAPI library from
dsource which has that function prototype and many others:
http://www.dsource.org/projects/bindings/wiki/WindowsApi
Sorry, 65001 is actually UTF-8 or UTF-7 IIRC. For CP-1252 you'll have
to find the correct value, I guess.
El 16/03/2011 19:27, Andrej Mitrovic escribió:
import std.c.windows.windows;
extern(Windows) BOOL SetConsoleOutputCP(UINT);
SetConsoleOutputCP(65001);
Tried a bunch of values and all yields the same result.
Thanks anyway.
El 16/03/2011 19:27, Andrej Mitrovic escribió:
Otherwise you might be interested in using the WinAPI library from
dsource which has that function prototype and many others:
http://www.dsource.org/projects/bindings/wiki/WindowsApi
Mmh, the whole winapi just for that seems a little too much. :S
El 16/03/2011 20:36, Tom escribió:
El 16/03/2011 19:27, Andrej Mitrovic escribió:
import std.c.windows.windows;
extern(Windows) BOOL SetConsoleOutputCP(UINT);
SetConsoleOutputCP(65001);
Tried a bunch of values and all yields the same result.
Thanks anyway.
Forget it, I'll just use chcp...
On 3/17/11, Tom t...@nospam.com wrote:
El 16/03/2011 20:36, Tom escribió:
El 16/03/2011 19:27, Andrej Mitrovic escribió:
import std.c.windows.windows;
extern(Windows) BOOL SetConsoleOutputCP(UINT);
SetConsoleOutputCP(65001);
Tried a bunch of values and all yields the same result.
Thanks
El 16/03/2011 21:21, Andrej Mitrovic escribió:
On 3/17/11, Tomt...@nospam.com wrote:
El 16/03/2011 20:36, Tom escribió:
El 16/03/2011 19:27, Andrej Mitrovic escribió:
import std.c.windows.windows;
extern(Windows) BOOL SetConsoleOutputCP(UINT);
SetConsoleOutputCP(65001);
Tried a bunch of
31 matches
Mail list logo