Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 31, 2015 How to open a webpage in D? | ||||
---|---|---|---|---|
| ||||
I thought that perhaps spawing a process would work but execute("PATH TO HTML FILE",null,Config.none,size_t.max,dirName(exepath)); Didn't seem to work? any ideas? |
August 31, 2015 Re: How to open a webpage in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Taylor Hillegeist | On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist wrote: > I thought that perhaps spawing a process would work but Try the browse function from std.process: http://dlang.org/phobos/std_process.html#browse What it does is execute a browser process with the given argument. I think a filename will work as well as a url. |
August 31, 2015 Re: How to open a webpage in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Taylor Hillegeist | On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist wrote: > I thought that perhaps spawing a process would work but > > execute("PATH TO HTML FILE",null,Config.none,size_t.max,dirName(exepath)); > > Didn't seem to work? any ideas? Use curl: void main(string[] args) { import std.stdio, std.net.curl, std.algorithm; "http://rosettacode.org/wiki/Web_scraping" .byLine .each!writeln; } compile with dmd -L-lcurl test.d See http://dlang.org/phobos/std_net_curl.html Also note that if you want to spawn a process you have to specify an executable, giving a HTML file as your example suggests wouldn't work. |
August 31, 2015 Re: How to open a webpage in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Taylor Hillegeist | On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist wrote:
> I thought that perhaps spawing a process would work but
>
> execute("PATH TO HTML FILE",null,Config.none,size_t.max,dirName(exepath));
>
> Didn't seem to work? any ideas?
Actually executeShell worked for me thanks for the reference to Std.process.
|
August 31, 2015 Re: How to open a webpage in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Monday, 31 August 2015 at 22:24:28 UTC, Adam D. Ruppe wrote:
> On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist wrote:
>> I thought that perhaps spawing a process would work but
>
> Try the browse function from std.process:
>
> http://dlang.org/phobos/std_process.html#browse
>
> What it does is execute a browser process with the given argument. I think a filename will work as well as a url.
Browse is obviously the coolest solution. :)
|
Copyright © 1999-2021 by the D Language Foundation