Re: Need more examples ...

Arie van Wingerden <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <CADkALSFw4XY+XgF=vPpdRnt5upyfCwH3wH4GbgXk5xwN52_VWg@mail.gmail.com>
2016-12-09 13:18 GMT+01:00 Pontus Östlund <[email protected]>:

>
> 9 dec. 2016 kl. 12:33 skrev Arie van Wingerden <[email protected]>:
>
> When trying things out I find a huge module reference but a limited
> tutorial and manual.
>
> E.g. I try to open a textfile for read.
> I find:
>   - Stdio.File (non-buffered)
>   - Stdio.FILE (buffered)
> However I cannot find a simple example of how to use it ...
>
> I tried several ways to use the open() method, but then it says that
> neither Stdio.File nor Stdio.FILE have an open method, which is not conform
> the module reference.
>
> Maybe I missed the obvious :-)
>
> So, are there more examples available???
>
>
> We could for sure be better at providing examples and tutorials. One of
> these days...
>
> There are many ways to read a file:
>
> The whole file in one sweep:
>
> string s = Stdio.read_file("file.ext");
>
> And I guess this one way of using the File object.
>
> Stdio.File f = Stdio.File("file.ext", "r");
>

​I used this, but I was not sure what it *meant* ...
Does this open the file?
Is this the work of a "create" method?​


> or alternatively
>
> Stdion.File f = Stdio.File();
>

​So is there a kind of default constructor at work?​



> f->open("file.ext", "r");
>
> and then
>
> string a = f->read(1024); -> read one kb
> string b = f->read();     -> read to end of file or stream
>
>
> Hope this works.
>
>
> # Pontus
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.