Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Kagamin via Digitalmars-d-learn
if(GetFileType(GetStdHandle(STD_OUTPUT_HANDLE))==FILE_TYPE_PIPE)setvbuf()

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Kagamin via Digitalmars-d-learn
That said, full buffering for pipes may be not all that profitable, so it makes sense to always set line buffering for pipes and leave full buffering only for file.

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 14:08:39 UTC, Adam D. Ruppe wrote: On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse wrote: Is there a way to detect programmatically if I'm in an environment where I need to manually set line buffering? Part of the problem is the IDE console and

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 14:14:46 UTC, Paul Backus wrote: You can check the TERM environment variable [2], or you can use the POSIX uname() function [3] to see if you're running under Cygwin specifically. If there are any other environments where you need to manually set

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse wrote: On Saturday, 19 September 2020 at 13:32:07 UTC, Paul Backus wrote: http://dpldocs.info/experimental-docs/std.stdio.File.setvbuf.1.html Thanks. I don't have a clone of druntime/Phobos available to me right now, so some

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse wrote: Is there a way to detect programmatically if I'm in an environment where I need to manually set line buffering? Part of the problem is the IDE console and cygwin too I believe both *look* like a pipe to the program instead of

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:32:07 UTC, Paul Backus wrote: On Saturday, 19 September 2020 at 13:23:29 UTC, Anonymouse wrote: On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:23:29 UTC, Anonymouse wrote: On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main stdio thing I came across that I couldn't do from within @safe was

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main stdio thing I came across that I couldn't do from within @safe was stdout.flush(), which I need to call manually for Cygwin terminals and

Re: Cannot call @system funciton (stdout)

2020-08-18 Thread Kagamin via Digitalmars-d-learn
On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main stdio thing I came across that I couldn't do from within @safe was stdout.flush(), which I need to call manually for Cygwin terminals and some terminals embedded in editors (vscode). If someone

Re: Cannot call @system funciton (stdout)

2020-08-16 Thread Joel via Digitalmars-d-learn
On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: On Sunday, 16 August 2020 at 10:07:02 UTC, Simen Kjærås wrote: On Saturday, 15 August 2020 at 23:59:36 UTC, Joel wrote: [...] First, what's wrong with using writeln and friends instead of directly mucking about with stdout? :p

Re: Cannot call @system funciton (stdout)

2020-08-16 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 16 August 2020 at 10:07:02 UTC, Simen Kjærås wrote: On Saturday, 15 August 2020 at 23:59:36 UTC, Joel wrote: ../../JMiscLib/source/jmisc/base.d(176,2): Error: @safe function jmisc.base.upDateStatus!string.upDateStatus cannot call @system function

Re: Cannot call @system funciton (stdout)

2020-08-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/16/20 6:07 AM, Simen Kjærås wrote: On Saturday, 15 August 2020 at 23:59:36 UTC, Joel wrote: ../../JMiscLib/source/jmisc/base.d(176,2): Error: @safe function jmisc.base.upDateStatus!string.upDateStatus cannot call @system function std.stdio.makeGlobal!"core.stdc.stdio.stdout".makeGlobal

Re: Cannot call @system funciton (stdout)

2020-08-16 Thread Simen Kjærås via Digitalmars-d-learn
On Saturday, 15 August 2020 at 23:59:36 UTC, Joel wrote: ../../JMiscLib/source/jmisc/base.d(176,2): Error: @safe function jmisc.base.upDateStatus!string.upDateStatus cannot call @system function std.stdio.makeGlobal!"core.stdc.stdio.stdout".makeGlobal

Cannot call @system funciton (stdout)

2020-08-15 Thread Joel via Digitalmars-d-learn
../../JMiscLib/source/jmisc/base.d(176,2): Error: @safe function jmisc.base.upDateStatus!string.upDateStatus cannot call @system function std.stdio.makeGlobal!"core.stdc.stdio.stdout".makeGlobal /Library/D/dmd/src/phobos/std/stdio.d(4837,20):