Re^2: C++

Christos Ricudis Christos_Ricudis at p98.f11.n413.z2.fidonet.gr
Fri Nov 28 08:43:11 EET 1997


Hello Linux-greek-users!

In <LINUX-USERS.GR> Linux-greek-users wrote:

 L>   A, twra pou to thymithika. Yparxei kai mia satanika low-level
 L> synarthsh, h mmap() pou kanei paromoia douleia alla xwris na 
 L> xreiazetai na

Ka8olou satanika low level den einai, kai ma8e na th xrhsimopoieis giati einai
panemorfh, POSIXath, pangrhgorh, kai POLY xrhsimh : 


#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>

void main (void) {
        char *kor; int kot, korr=0, kra=0, kott=0; struct stat kuku;

        kot=open("/etc/group",O_RDONLY);
        fstat(kot,&kuku);

        kor=(char *)mmap(0,kuku.st_size,PROT_READ,MAP_SHARED,kot,0);

        while (korr<kuku.st_size) {
                if (kor[korr++]=='\n') {
                        printf("line %d has size %d\n",++kra,kott);
                        kott=0;
                } else {
                        kott++;
                }
        }
        munmap((void *)kor,kuku.st_size);
}



Christos Ricudis, ricudis at paiko.gr                              2:413/11.0.
--
====================================================================
Gia na mathete pos na xrisimopoiite ton majordomo, stilte e-mail
sto "majordomo at argos.hol.gr" me 1 grammi sto keimeno: help
Ta archives tis listas einai sto http://www.argos.hol.gr/lists
Gia opoiodipote problima stilte  e-mail ston owner-linux-greek-users
====================================================================



More information about the Linux-greek-users mailing list