digitalmars.D - Updated std.stdio
- kinghajj (9/9) Aug 19 2004 Nobody commented on my last post ("inputting functions for std.stdio"), ...
- Ben Hinkle (8/17) Aug 19 2004 some first impressions:
- kinghajj (4/9) Aug 19 2004 That 'f' means format (I always wondered what that meant...)? Ok... but,
- kinghajj (7/7) Aug 19 2004 I changed some things: I've removed the unneeded 'f's and I added new fu...
- Arcane Jill (15/21) Aug 19 2004 I had a look at the source file, but it wasn't clear to me how you decid...
Nobody commented on my last post ("inputting functions for std.stdio"), so I'll re-post it. I've added new functions readf(), readfln(), freadf(), and freadfln() to std.stdio. readf() - reads a line from stdin, but does not include the newline readfln() - reads a line from stdin, and includes the newline freadf(FILE* fp) - reads a line from fp, but does not include the newline freadfln(FILE* fp) - reads a line from fp, and includes the newline The updated version is here: http://kinghajj.home.comcast.net/stdio.d
Aug 19 2004
some first impressions: - the "f" in writef stands for "format" and since there isn't any format involved in readf it should be called something else - like readLine or getLine something... - accepting a buffer to fill would be nice (see std.stream.readLine) "kinghajj" <kinghajj_member pathlink.com> wrote in message news:cg2sdr$29lt$1 digitaldaemon.com...Nobody commented on my last post ("inputting functions for std.stdio"), soI'llre-post it. I've added new functions readf(), readfln(), freadf(), and freadfln() to std.stdio. readf() - reads a line from stdin, but does not include the newline readfln() - reads a line from stdin, and includes the newline freadf(FILE* fp) - reads a line from fp, but does not include the newline freadfln(FILE* fp) - reads a line from fp, and includes the newline The updated version is here: http://kinghajj.home.comcast.net/stdio.d
Aug 19 2004
In article <cg2tet$2ahv$1 digitaldaemon.com>, Ben Hinkle says...some first impressions: - the "f" in writef stands for "format" and since there isn't any format involved in readf it should be called something else - like readLine or getLine something... - accepting a buffer to fill would be nice (see std.stream.readLine)That 'f' means format (I always wondered what that meant...)? Ok... but, readLine exists already... Accecpt a buffer: you mean like "read(buf)"? I think I could do that.
Aug 19 2004
I changed some things: I've removed the unneeded 'f's and I added new functions: read(out char[] buf) readln(out char[] buf) fread(FILE *fp, out char[] buf) freadln(FILE *fp, out char[] buf) Fairly self-explanatory. Again, it's here: http://kinghajj.home.comcast.net/stdio.d
Aug 19 2004
In article <cg2sdr$29lt$1 digitaldaemon.com>, kinghajj says...I've added new functions readf(), readfln(), freadf(), and freadfln() to std.stdio. readf() - reads a line from stdin, but does not include the newline readfln() - reads a line from stdin, and includes the newline freadf(FILE* fp) - reads a line from fp, but does not include the newline freadfln(FILE* fp) - reads a line from fp, and includes the newlineI had a look at the source file, but it wasn't clear to me how you decide what is or is not a newline. Anyway, for the record, in Unicode, any of the following should be accepted as "newline": U+000A (Carriage Return) U+000A U+000D (Carriage Return followed by Line Feed) U+000D (Line Feed) U+0085 (Next Line) U+2028 (Line Separator) U+2029 (Paragraph Separator) Also, when reading a line from a file, normally you don't care what kind of newline was used to terminate the line - however, sometimes you do, and therefore it might also be useful also to return that information somehow. Arcane Jill
Aug 19 2004