Re: file io

2018-09-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/6/18 2:30 PM, Steven Schveighoffer wrote: On 9/6/18 1:07 PM, rikki cattermole wrote: On 07/09/2018 4:17 AM, Arun Chandrasekaran wrote: On Thursday, 6 September 2018 at 16:13:42 UTC, hridyansh thakur wrote: how to read a file line by line in D std.stdio.File.byLine() Refer the doc

Re: file io

2018-09-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/6/18 1:07 PM, rikki cattermole wrote: On 07/09/2018 4:17 AM, Arun Chandrasekaran wrote: On Thursday, 6 September 2018 at 16:13:42 UTC, hridyansh thakur wrote: how to read a file line by line in D std.stdio.File.byLine() Refer the doc here:

Re: file io

2018-09-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/09/2018 4:17 AM, Arun Chandrasekaran wrote: On Thursday, 6 September 2018 at 16:13:42 UTC, hridyansh thakur wrote: how to read a file line by line in D std.stdio.File.byLine() Refer the doc here: https://dlang.org/library/std/stdio/file.by_line.html An example from the doc: ```

Re: file io

2018-09-06 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Thursday, 6 September 2018 at 16:13:42 UTC, hridyansh thakur wrote: how to read a file line by line in D std.stdio.File.byLine() Refer the doc here: https://dlang.org/library/std/stdio/file.by_line.html An example from the doc: ``` import std.algorithm, std.stdio, std.string; // Count

file io

2018-09-06 Thread hridyansh thakur via Digitalmars-d-learn
how to read a file line by line in D

File IO: C# streams VS iterators?

2013-11-07 Thread DDD
to port. I haven't access file in D and i'm completely confused. What are iterators in regards to file IO?

Re: File IO: C# streams VS iterators?

2013-11-07 Thread Lionello Lunesu
that is an issue if you want to port. I haven't access file in D and i'm completely confused. What are iterators in regards to file IO? There are several ranges that can be used for file IO, for example http://dlang.org/phobos/std_stdio.html#.File.byChunk and http://dlang.org/phobos/std_stdio.html

Re: File IO: C# streams VS iterators?

2013-11-07 Thread Jacob Carlborg
that is an issue if you want to port. I haven't access file in D and i'm completely confused. What are iterators in regards to file IO? he must have said ranges. A range is like a pair of iterators. It's heavily used in D. -- /Jacob Carlborg

Re: File IO: C# streams VS iterators?

2013-11-07 Thread Jacob Carlborg
On 2013-11-08 04:22, Lionello Lunesu wrote: However, sometimes it's useful to have polymorphism for accessing streams, especially when porting C#/java code to D. In that case it would be pretty trivial to port the base classes to D and implement them using the D ranges. For that, there's

Re: Multithreaded file IO?

2011-09-29 Thread Christophe
Jerry , dans le message (digitalmars.D.learn:29830), a écrit : trav...@phare.normalesup.org (Christophe) writes: Jerry Quinn , dans le message (digitalmars.D.learn:29763), a écrit : What I really want is a shared fifo where the input is lines from a file, and many workers grab something

Re: Multithreaded file IO?

2011-09-28 Thread Jerry
trav...@phare.normalesup.org (Christophe) writes: Jerry Quinn , dans le message (digitalmars.D.learn:29763), a écrit : What I really want is a shared fifo where the input is lines from a file, and many workers grab something from the fifo. They then push their results into a shared

Re: Multithreaded file IO?

2011-09-25 Thread Jerry Quinn
Jonathan M Davis Wrote: On Saturday, September 24, 2011 01:05:52 Jerry Quinn wrote: Jonathan M Davis Wrote: On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote: A direct rewrite would involve using shared and synchronized (either on the class or a synchronized block around

Re: Multithreaded file IO?

2011-09-25 Thread Jerry Quinn
Lutger Blijdestijn Wrote: If you didn't know, the concurrency chapter of tdpl is a free chapter: http://www.informit.com/articles/article.aspx?p=1609144 It has an example of file copying with message passing: http://www.informit.com/articles/article.aspx?p=1609144seqNum=7 What I really

Re: Multithreaded file IO?

2011-09-25 Thread Jonathan M Davis
On Sunday, September 25, 2011 02:26:18 Jerry Quinn wrote: Jonathan M Davis Wrote: On Saturday, September 24, 2011 01:05:52 Jerry Quinn wrote: Jonathan M Davis Wrote: On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote: A direct rewrite would involve using shared and

Re: Multithreaded file IO?

2011-09-25 Thread Lutger Blijdestijn
Jerry Quinn wrote: Jonathan M Davis Wrote: On Saturday, September 24, 2011 01:05:52 Jerry Quinn wrote: Jonathan M Davis Wrote: On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote: A direct rewrite would involve using shared and synchronized (either on the class or a

Re: Multithreaded file IO?

2011-09-24 Thread Lutger Blijdestijn
If you didn't know, the concurrency chapter of tdpl is a free chapter: http://www.informit.com/articles/article.aspx?p=1609144 It has an example of file copying with message passing: http://www.informit.com/articles/article.aspx?p=1609144seqNum=7

Multithreaded file IO?

2011-09-23 Thread Jerry Quinn
Hi folks, I wasn't sure whether this should go here or in the D devel list... I'm trying to port a program where threads read from a file, process the data, then write the output data. The program is cpu-bound. In C++ I can do something like this: class QueueIn { ifstream in; mutex m;

Re: Multithreaded file IO?

2011-09-23 Thread Jonathan M Davis
On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote: Hi folks, I wasn't sure whether this should go here or in the D devel list... I'm trying to port a program where threads read from a file, process the data, then write the output data. The program is cpu-bound. In C++ I can do

Re: Multithreaded file IO?

2011-09-23 Thread Jerry Quinn
Jonathan M Davis Wrote: On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote: A direct rewrite would involve using shared and synchronized (either on the class or a synchronized block around the code that you want to lock). However, the more idiomatic way to do it would be to use

Re: 2 File IO Questions (Phobos)

2009-11-07 Thread Frank Benoit
Zane schrieb: Doh! I still need help with number 2, but for number 1, all I needed was to use 'writeString' instead of 'write'. Like I said, still getting used to Phobos. Like I said, I still need help on the destructor question (#2). Thanks, Zane desctructors are called in not defined