Commit graph

199 commits

Author SHA1 Message Date
Nick Treleaven
ad003aa618 Fix note about retaining buffer contents 2013-07-08 15:07:38 +01:00
Nick Treleaven
e90c141a78 Change 'is reused' to 'you can reuse' for clarity 2013-07-06 12:46:40 +01:00
Nick Treleaven
f7bec656d2 Use 'void main' instead of 'int main' in examples 2013-07-06 12:38:04 +01:00
Nick Treleaven
f34b41f33f Fix & improve readln, File.readln docs
Purge phantom fp parameter.
Add missing parameters and throws info.
Fix File.readln(buf) example to use char[] buf for reuse, not string.
Fix swapped readln() and File.readln() examples.
Separate readln() and readln(buf) docs because the behaviour and
return types are different.
2013-07-06 12:38:02 +01:00
unknown
30790ee53c Fixup readln.
Fixes an issue where `readln!S` did not forward the type "S" in `stdin.readln()` => `stdin.readln!S()` (that was my mistake, sorry)

Fixes an issue where `File.readln!S` assumed S was an "immutable string type". This should work:

char[] buf;
buf = myFile.readln!(char[])();

While buf is not reused after each call, there should be nothing preventing the user for mutating if he so (explicitly) wishes.

Added/improved unittests a wee little bit.
2013-07-03 15:10:24 +02:00
monarch dodra
3cd2060e21 Improve restraints for readln 2013-07-02 09:00:25 +02:00
monarch dodra
73cd4b90f7 Improve iteration scheme for wchar/dchar 2013-07-02 08:37:48 +02:00
monarch dodra
738a7879d4 Fix wchar/dchar issue
Just cause a file is nativelly treated as UTF16 (or something), doesn't mean you can iterate wchars.
2013-07-01 19:15:45 +02:00
monarch dodra
97cec336a1 Fix Issue 10517 - readln(Char)(Char[] buf) accepts non-mutable buffers
Also templatizes a global readln
2013-07-01 19:14:48 +02:00
k-hara
2f21ff0c74 More fix for issue 313 & 314 2013-06-25 17:01:52 +09:00
k-hara
03a32d6fa4 Fix issue 313 & 314 2013-06-25 08:38:30 +09:00
Andrei Alexandrescu
383c029e2c nits 2013-05-31 19:26:20 -04:00
Ferdinand Majerech
4c713c311d DDoc: std.stdio.byLine documentation fix and examples.
Removed the redundant /// ditto and added two examples to make it obvious to a newcomer how a range is useful here.
2013-06-01 00:33:15 +03:00
Frank van Dijk
a34861d80c [10116] stdio.File.byLine repeats last line forever, readln(ref C[],R) returns bad data
byLine expects readln to return with an empty buffer on end-of-stream,
which readln does not do for wchar and dchar. Also, the readln variant
that takes a terminator range returns incorrect concatenations of
lines because of the same issue. Fixed by setting buffer.length=0 in
readln for this case. Unit test updated to detect this issue.
2013-05-19 11:06:12 +02:00
Tim Keating
db6b492af3 Fix some borkage with documentation of File.readln variants; add a better example for File.readln(buf) that emphasizes the need to copy the buffer, since it is overwritten when read 2013-05-10 00:27:38 -05:00
Lars T. Kyllingstad
aa57a2a161 Renamed File.isPipe to isPopened
Now that std.process will support pipe creation, the name isPipe will
only cause confusion, as it will in fact be false for "normal" anonymous
pipes.  It is only true for files opened by popen(), and its purpose is
simply to ensure they are closed with pclose().
2013-04-30 21:07:33 +02:00
Lars T. Kyllingstad
28abab44cf StdioException: No system error msg when errno==0 2013-04-30 21:05:28 +02:00
Lars T. Kyllingstad
8a95cadf29 Make std.stdio.File 'package' accessible
This is required in the new std.process.
2013-04-30 21:03:56 +02:00
Andrei Alexandrescu
176976a57b Merge pull request #1238 from denis-sh/add-note-about-Issue-7648
Add note about Issue 7648 to `std.stdio.File`.
2013-04-17 13:13:01 -07:00
Ferdinand Majerech
402af9d0c4 DDoc -std.stdio: exceptions thrown by C-like API.
Updated documentation for all the C-like member functions \
(and the File ctor) to specify exactly what gets thrown when. 

(note: Exceptions in std.stdio are a mess and should be made 
 more consistent. Also, it seems some member functions that 
 should check if the file is opened do not, but I don't know
 if that might be intentional (as the C functions should fail 
 anyway, resulting in a throw))
2013-04-10 23:36:27 +03:00
Denis Shelomovskij
c372571d1f Add note about Issue 7648 to std.stdio.File.
Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=7648
2013-04-03 23:27:29 +04:00
Jonathan M Davis
30d3d470e7 Merge pull request #1139 from monarchdodra/stdio
Errors vs Exception in stdio
2013-03-06 20:16:45 -08:00
unknown
0712f9f3a0 Throw RangeError 2013-02-13 21:36:58 +01:00
Andrej Mitrovic
2844f0ef3b Fixes Issue 9444 - Exception must be thrown on Posix when shell() call fails. 2013-02-12 23:42:42 +01:00
1100110
8b8ed8c652 Fix broken example.
That one example wouldn't compile, so I fixed it.
2013-02-07 13:07:01 -06:00
Brad Roberts
e87f1c20a7 only marginally better than disabling all testing on win64 2012-11-26 05:31:07 +00:00
k-hara
01df2f60be Remove redundant parenthesis for getters, and use assignment syntax for setters 2012-11-23 15:07:17 +09:00
alexrp
b202180295 Remove all uses of sizediff_t in favor of ptrdiff_t. 2012-10-15 04:24:09 +02:00
Walter Bright
04f452fc5d add Win64 to stdio 2012-10-07 02:12:31 -07:00
Andrei Alexandrescu
a37e919421 Merge pull request #819 from jpf91/lfs
Get rid of transitional lfs API
2012-10-06 21:34:05 -07:00
Andrei Alexandrescu
ad87f38197 Merge pull request #778 from denis-sh/std.stdio.File-fixes
Std.stdio.file fixes
2012-10-04 09:51:12 -07:00
Denis Shelomovskij
13a87ff8ca Improve std.stdio.File.{writef,writefln}
* don't throw AssertError in writef
* make these functions consistent with std.format.formattedWrite
2012-10-04 11:32:08 +04:00
Denis Shelomovskij
e281d8deaa Fix Issue 8219 - File.writeln is slow
There is absolutely no need to explicitly flush a stream on new line because it is expected only for console output which is line buffered or unbuffered by default.
2012-10-04 11:32:08 +04:00
Denis Shelomovskij
71fe49fdf1 Rename std.stdio.File.p to _p 2012-10-04 11:32:07 +04:00
Denis Shelomovskij
4c33328fbf Remove redundant std.stdio.File.Impl.name 2012-10-04 11:02:32 +04:00
Denis Shelomovskij
26b7d3fad3 Fix std.stdio.File part of Issue 4624 2012-10-04 11:02:16 +04:00
Denis Shelomovskij
84a6468ef8 Fix Issue 7659 - std.stdio.File.close() erases file.name
* also improve documentation a bit
2012-10-04 10:36:36 +04:00
Denis Shelomovskij
46a535cb19 Refactor std.stdio.File 2012-10-04 10:36:36 +04:00
Johannes Pfau
f989b219cc Get rid of transitional lfs API
Those kind of functions should be placed in druntime,
but the *64 (v) functions as a public interface are actually
deprecated and shouldn't be used anymore.

Druntime takes care that the normal stat, fopen, calls support
large files, if __USE_FILE_OFFSET64 is defined (which is what
the new C API does as well)

Note: It's actually important to use the functions from
core.sys.posix.stdio as the functions in core.stdc.stdio
are not large file aware. This is probably a bug in druntime.
2012-09-30 10:47:40 +02:00
Denis Shelomovskij
d7a60b3b8a Disable non-ASCII characters test because of snn.lib Issue 8643 2012-09-12 11:15:30 +04:00
Denis Shelomovskij
e5e123854e Partial Fix Issue 7648 - std.stdio expects file names to be encoded in CP_ACP on Windows instead of UTF-8 2012-09-12 00:42:00 +04:00
Artem Tarasov
c8e0469019 fix std.stdio.byLine behaviour 2012-08-11 12:34:32 +04:00
k-hara
c6dc1711c4 fix template constraints 2012-08-06 01:05:06 +09:00
k-hara
07ec7ce34f fix Issue 8386 - writeln stopped working with wstring 2012-07-17 01:58:39 +09:00
alexrp
85c1f161c0 Adding myself as author to the modules I have contributed to.
This is just me committing to maintain my code additions to
these modules. We should, in general, use these author lists
more so we know who's responsible for the various modules.
2012-07-16 05:31:09 +02:00
Denis Shelomovskij
64f93b970a Replace typeof(<type>.init[0]) with templates
* ElementEncodingType (12)
* ElementType(1)
2012-07-11 12:58:40 -07:00
jmdavis
02931eb501 Revert "Merge pull request #664 from denis-sh/add-ArrayTarget-template"
This reverts commit f4d0a49493, reversing
changes made to 3cb69914c5.

The merging of request #664 was accidental, and it should not have been
merged. See https://github.com/D-Programming-Language/phobos/pull/664
for details.
2012-07-11 11:49:28 -07:00
Andrei Alexandrescu
0b4df6a57b Merge pull request #669 from alexrp/errno
Use errno instead of getErrno in Phobos.
2012-07-08 18:31:55 -07:00
alexrp
adcac57526 Use errno instead of getErrno in Phobos. 2012-07-09 01:26:02 +02:00
David Simcha
f4d0a49493 Merge pull request #664 from denis-sh/add-ArrayTarget-template
Add array target template
2012-07-08 13:08:27 -07:00