Информатика и технология программирования


Вопросы без ответов - часть 3


default: cout &#60&#60 (char*)p; break;
}
free(p);
}
//------------------------------------------------------ 15


char *F(int n, FILE *fd)
{ int m;
char *p;
long fp;
fseek(fd, sizeof(long)*n,SEEK_SET);
fread(&#38fp,sizeof(long),1,fd);
fseek(fd,fp,SEEK_SET);
fread(&#38m,sizeof(int),1,fd);
p=new char [m];
fread(p,m,1,fd);
return p ;
}
//------------------------------------------------------ 16


char *F(int n, FILE *fd1, FILE *fd2)
{
long pp;
char *q;
fseek(fd1,n*sizeof(long,SEEK_SET));
fread(&#38pp,sizeof(long),1,fd1);
q = new char[80];
fseek(fd2,pp,SEEK_SET);
fgets(q,80,fd2);
return q;
}
//------------------------------------------------------ 17


char **F(FILE *fd)
{ int n,m,i;
char **p;
long *fp;
fseek(fd, 0L,SEEK_SET);
fread(&#38n,sizeof(int),1,fd);
p = new char *[n+1];
fp = malloc(sizeof(long)*n);
fread(fp,sizeof(long,n,fd));
for (i=0; i&#60n; i++)
{
fseek(fd, fp[i],SEEK_SET);
fread(&#38m,sizeof(int),1,fd);
p[i]= new char[m];
fread(p[i],m,1,fd);
}
p[n]=NULL;
return p ;
}
//------------------------------------------------------ 18


&#35define FNULL -1L
struct ooo { ooo *p[20]; char *s; long fs; long fp[20]; }
ooo *F(FILE *fd, long pos)
{
int i,m;
ooo *q;
if (pos==FNULL) return NULL;
q = new ooo;
fseek(fd,pos,SEEK_SET);
fread(q, sizeof(ooo),1,fd);
fseek(fd,q-&#62fs,SEEK_SET);
fread(&#38m,sizeof(int),1,fd);
q-&#62s= new char[m];
fread(q-&#62s,m,1,fd);
for (i=0; i&#60 20; i++) q-&#62p[i]=F(fd,q-&#62fp[i]);
return q;
}
void main() {ooo *head = F(fd,0L); }
//------------------------------------------------------ 19


struct man { int dd,mm,yy; char *addr};
man *F(FILE *fd)
{ man *p;
int n;
fread(&#38n,sizeof(int),1,fd);
p = new man;
fread (p, sizeof(man),1,fd);
n = n - sizeof(man);
p-&#62addr = new char[n];
fread(p-&#62addr,n,1,fd);
return(p);
}
//------------------------------------------------------ 20


struct man { int dd,mm,yy; char *addr};
void F(FILE *fd, man *p)
{ int n;
n = sizeof(man)+strlen(p-&#62addr)+1;
fseek(fd,0L,SEEK_END);
fwrite(&#38n,sizeof(int),1,fd);
fwrite (p, sizeof(man),1,fd);
n = n - sizeof(man);
fwrite (p-&#62addr, n,1,fd );




Начало  Назад  Вперед



Книжный магазин