kano ta prota mou bimata....boithiste me parakalo

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Mar 31 22:50:02 EEST 2003


On 2003-03-31 17:46, Yannis Kotsinos <zookie at med.auth.gr> wrote:
>On Monday 31 March 2003 16:57, V13 wrote:
>>>> Παρακάτω ένα βιαστικό πρόγραμμα που έγραψα κι εγώ και κάνει αυτή τη
>>>> δουλειά:
>>>>
>>>> 	perl -e 'print reverse <>'
>>>
>>> Hehehe.  Den jero poso kala paizei auto me multimegabyte arxeia, alla
>>> einai ontws entupwsiako to ti mporei na ginei se mia perl grammh.
>>
>> E.. afoy afisame ta apla scripts kai piasame oysiastika glosses
>> programatismoy na kai kati antistixo se C... An eksereseis to write sto
>> stdout to ypoloipo prepei na'nai isos o poio grygoros tropos poy mporei na
>> ylopoihthei xoris na agxonetai gia to an to arxeio einai megalo h oxi...
>
> an kai @amato to sygkekrimeno programmataki kanei reverse kai toys xarakthres,
> enw emeis 8eloyme mono tis grammes :) Ara mallon prepei na elegxei gia
> newlines, na toys krata se kapoio index (ie. ena aplo int) kai meta na kaneis
> advance ton pointer gia na grapseis th grammh kai pali pisw kok. Sto mege8os
> toy kwdika nikane oi perlatzides...

    while (p2 <= p1) {
        while (*--p2 != '\n' && p2 <= p1)
                ;
        write(1, p2 + 1, p2 - p1 - 1);
    }

Ontws nikane oi Perl people sto megethos :P

> ps: to
>
> 	p2 = p1+s.st_size-1;
>
> einai gia na apofygeis to EOF?

Hint...

    [ 0  1  2  3  4  5  6  7  8  9  10 ]

    p1                                   0
    st_size                             10
    p1 + st_size                        10
    thesi teleutaiou valid index         9

- Giorgos




More information about the Linux-greek-users mailing list