Re: readln with buffer fails

2014-10-29 Thread dcrepid via Digitalmars-d-learn
On Wednesday, 29 October 2014 at 23:28:07 UTC, Justin Whear wrote: Part of what readln does is *modify* the slice itself, not just the pointed-to characters. In particular it alters the length member so that you know how much input was actually read. This is also why the rvalue reference sho

Re: readln with buffer fails

2014-10-29 Thread dcrepid via Digitalmars-d-learn
lol, if only I could edit my posts. The comment preceding the readln() call was wrong too. This is what I have now: // readln(buf) requires a slice *Reference*. // rvalue references aren't supported by D, so readln(Input[]) fails

Re: readln with buffer fails

2014-10-29 Thread dcrepid via Digitalmars-d-learn
err, I meant rvalue *reference* above

Re: readln with buffer fails

2014-10-29 Thread dcrepid via Digitalmars-d-learn
On Wednesday, 29 October 2014 at 21:19:25 UTC, Peter Alexander wrote: You need to take a slice of the buffer: char[] buf = Input[]; readln(buf); // line now in buf The reason for this is because you need to know where the string ends. If you just passed in Input, how would you know how long t

readln with buffer fails

2014-10-29 Thread dcrepid via Digitalmars-d-learn
I have this simple code: int main() { import std.stdio; char[4096] Input; readln(Input); //readln!(char)(Input); // also fails return 0; } I get these messages during compilation: test.d(39): Error: template std.stdio.readln cannot deduce function from argument types !()(ch

Re: DirEntry on Windows - wstring variant?

2014-10-24 Thread dcrepid via Digitalmars-d-learn
On Friday, 24 October 2014 at 22:53:15 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: Also, given how DirEntry works internally, I'd definitely be inclined to argue that it would be too much of a mess to support wstring unless it's by simply converting the name to a wstring when requeste

DirEntry on Windows - wstring variant?

2014-10-24 Thread dcrepid via Digitalmars-d-learn
As a Windows programmer using D, I find a number of questionable things with D's focus on using string everywhere. It's not a huge deal to add in UTF-8 to UTF-16 mapping in certain areas, but when it comes to working with a lot of data and Windows API calls, the less needless conversions the be

Re: dsource and WinAPI

2014-10-14 Thread dcrepid via Digitalmars-d-learn
Vladimir, thanks for looking at the pull request. It'd be great if the whole project was moved to GitHub to allow more people to contribute.

Re: dsource and WinAPI

2014-10-14 Thread dcrepid via Digitalmars-d-learn
Which project are you looking at? Bindings for the Windows API: http://www.dsource.org/projects/bindings/wiki/WindowsApi This is a pretty important project, especially for getting more Windows programmers on board.. thanks for your help

dsource and WinAPI

2014-10-13 Thread dcrepid via Digitalmars-d-learn
I've tried to create an account on dsource.org without success, and am wondering if anyone here knows if they are no longer accepting new users or whatnot? I've added a new winhttp.d source file for the win32 folder and would like to somehow contribute it. thanks!

Re: version assignment and module scope

2014-09-15 Thread dcrepid via Digitalmars-d-learn
no. it works the way it's intended to work. given that order of module imports is not defined (i.e. reordering imports should not affect resulting code), making 'version=' propagating to other modules will create disasterous side effects, even weirder than C macro abusing. Okay, thanks for th

version assignment and module scope

2014-09-15 Thread dcrepid via Digitalmars-d-learn
I'm a bit baffled why using something like this doesn't get recognized by imported modules: version = Unicode; I use this to try and alter the way the win32 API headers resolve certain symbols, but currently the only way to force that version symbol to be recognized correctly is to define it