From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4fba68cc1c671c3a X-Google-Attributes: gid103376,public From: sparre@meyer.fys.ku.dk (Jacob Sparre Andersen) Subject: Re: Web-page|socket|my-ada-program Date: 1997/03/04 Message-ID: <1997Mar4.140321.3543@news.nbi.dk>#1/1 X-Deja-AN: 223048683 References: Newsgroups: comp.lang.ada Date: 1997-03-04T00:00:00+00:00 List-Id: Markus Wahl (d95wahl@dtek.chalmers.se) wrote: __________ | I need to read not from st-input but from a web-page. | How can that be done. ^^^^^^^^^^ If the web page is on the same machine as the program, it's just to find the right file name, and then open the file as usual (using Ada.Text_IO.Open). If you want to access documents through HTTP, you have two options: 1) Download the document to a temporary file using a command line HTTP client such as w3c. You'll have to use the C function system to do this (I will include an example in this message). When the document is downloaded, you just open, read, close, and erase the temporary file. 2) Use a binding to the wwwlib. - You might have to write the binding yourself. |^^^^^^^^^^ | I have heard someone talk about sockets, but I don't know what it means. ^^^^^^^^^^ That's a low level UNIX(?) communication system. Greetings, Jacob -- Jacob Sparre Andersen http://www.nbi.dk/%7Esparre/ Center for Chaos and Turbulence Studies Phone: (+45) 39 65 53 51 The Niels Bohr Institute (+45) 35 32 53 05 -- MFWT - The new LEGO idea book! Contact: sebliss@compuserve.com ------------------------------------------------------------------------------ procedure Download (URL : in String; File_Name : in String) is use Interfaces.C; use Interfaces.C.Strings; function system (Command : chars_ptr) return Interfaces.C.int; pragma Import (C, system); Command_In_C_Format : chars_ptr := New_String ("w3c " & URL & " > " & File_Name); Error_Code : Interfaces.C.int := system (Command_In_C_Format); begin -- Download Free (Command_In_C_Format); if Error_Code /= 0 then Ada.Text_IO.Put_Line (File => Ada.Text_IO.Current_Error, Item => "Download: system returned " & Interfaces.C.int'Image (Error_Code)); raise System_Error; end if; end Download; ------------------------------------------------------------------------------