www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - how to pass stderr to core.stdc.stdio.fileno

reply berni <berni example.com> writes:
The following code doesn't work:

 int no = fileno(stderr);
The error message is: test.d(7): Error: function core.stdc.stdio.fileno (shared(_IO_FILE)*) is not callable using argument types (File) How can I cast stderr to something, that fileno() accepts?
Feb 17
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 17 February 2017 at 16:02:39 UTC, berni wrote:
 int no = fileno(stderr);
Try fileno(core.stdc.stdio.stderr); to force it to use the C stderr object instead of the D one. Alternatively, fileno(stderr.getFP()) should do it too. http://dpldocs.info/experimental-docs/std.stdio.File.getFP.html
Feb 17
parent reply berni <berni example.com> writes:
On Friday, 17 February 2017 at 16:08:11 UTC, Adam D. Ruppe wrote:
 Try

 fileno(core.stdc.stdio.stderr);

 to force it to use the C stderr object instead of the D one.

 Alternatively, fileno(stderr.getFP()) should do it too.
 http://dpldocs.info/experimental-docs/std.stdio.File.getFP.html
Many thanks! That worked. And also thanks for the link. I didn't know if this docs yet. :-)
Feb 17
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 17 February 2017 at 18:43:29 UTC, berni wrote:
 Many thanks! That worked. And also thanks for the link. I 
 didn't know if this docs yet. :-)
Yes, that is my documentation fork, it has a search feature if you do dpldocs.info/some_term and it tries to be easier to read and navigate, let me know how you like it!
Feb 17
next sibling parent reply berni <berni example.com> writes:
On Friday, 17 February 2017 at 19:16:44 UTC, Adam D. Ruppe wrote:
 Yes, that is my documentation fork, it has a search feature if 
 you do dpldocs.info/some_term and it tries to be easier to read 
 and navigate, let me know how you like it!
What I've seen so far, looks quite good. What I didn't understand was that large box below write in stdio. Maybe, it's because I'm not familiar with templates yet. But when I click on the question mark in the corner I get an empty search result, which, of course, doesn't explain anything.
Feb 17
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 17 February 2017 at 19:36:50 UTC, berni wrote:
 What I didn't understand was that large box below write in 
 stdio. Maybe, it's because I'm not familiar with templates yet.
That's the function signature, listing the arguments, types, etc. On write, it is mostly empty, write is relatively simple, and i designed it more for complicated ones. Like my create window constructor: http://dpldocs.info/experimental-docs/arsd.simpledisplay.SimpleWindow.this.1.html there you can see a pretty traditional arguments list. Complicated templates can be more readable too, like sort: http://dpldocs.info/experimental-docs/std.algorithm.sorting.sort.html though the short answer is "give it an array", the long answer there explains what else it can take too.
 But when I click on the question mark in the corner I get an 
 empty search result, which, of course, doesn't explain anything.
yeah i haven't written that page yet
Feb 17
prev sibling parent reply berni <berni example.com> writes:
As I cannot find any PM-feature in this forum and don't know how 
to contact you else, I'm hijacking this thread to give you some 
feedback...

On Friday, 17 February 2017 at 19:16:44 UTC, Adam D. Ruppe wrote:
 Yes, that is my documentation fork, it has a search feature if 
 you do dpldocs.info/some_term and it tries to be easier to read 
 and navigate, let me know how you like it!
I tried dpldocs.info/max looking for a function that gives the maximum of two or more values. I got a lot of results, but non of them was, what I was looking for. Meanwhile I found it, namely this one: http://dpldocs.info/experimental-docs/std.algorithm.comparison.max.html Maybe you can figure out, why this is not included in the search result?
Feb 22
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Wednesday, 22 February 2017 at 19:46:28 UTC, berni wrote:
 As I cannot find any PM-feature in this forum and don't know 
 how to contact you else, I'm hijacking this thread to give you 
 some feedback...
You can always email me directly too, destructionator gmail.com
 Maybe you can figure out, why this is not included in the 
 search result?
It was a bug in the pagination, that function was on page two, which I don't show (my experience is if the search result isn't on page one, you're wasting your time anyway and should refine the terms)... but it should have been on page one. That's fixed, and I tweaked the score algorithm to give it a bonus because it is a free-standing function with a matching name instead of some member variable. So now it shows as the first result.
Feb 22