Read Complete File to Array of Lines
Era Scarecrow
rtcvb32 at yahoo.com
Fri May 11 13:43:45 PDT 2012
On Friday, 11 May 2012 at 20:40:23 UTC, Paul wrote:
> On Friday, 11 May 2012 at 18:02:54 UTC, Jesse Phillips wrote:
>> void main() {
>> foreach(line; readText("file.in").splitLines()) ...
>> }
>
> Thanks Jesse.
> I'm finding that I can't just substitute args[1] for a text
> string. Is there a clever way to use args[] in place of your
> "file.in"?
Why not?
void main(string[] args) {
if(args.length > 1) {
foreach(line; readText(args[1]).splitLines()) ...
}
}
More information about the Digitalmars-d-learn
mailing list