I am running one a BSD Server. This is from the Ascii Pfiles 2.0b Patch I would very much like it if someone could point out whats wrong? Here is the error: diskio.c: In function `fbopen_for_read': diskio.c:144: structure has no member named `_fileno' diskio.c: In function `fbcat': diskio.c:324: structure has no member named `_fileno' *** Error code 1 Here is the Two Functions: FBFILE *fbopen_for_read(char *fname) { int err; FILE *fl; struct stat sb; FBFILE *fbfl; if(!(fbfl = (FBFILE *)malloc(sizeof(FBFILE)))) return NULL; if(!(fl = fopen(fname, "r"))) { free(fbfl); return NULL; } err = fstat(fl, &sb); if(err < 0 || sb.st_size <= 0) { free(fbfl); fclose(fl); return NULL; } fbfl->size = sb.st_size; if(!(fbfl->buf = malloc(fbfl->size))) { free(fbfl); return NULL; } if(!(fbfl->name = malloc(strlen(fname)))) { free(fbfl->buf); free(fbfl); return NULL; } fbfl->ptr = fbfl->buf; fbfl->flags = FB_READ; strcpy(fbfl->name, fname); fread(fbfl->buf, sizeof(char), fbfl->size, fl); fclose(fl); return fbfl; } and int fbcat(char *fromfilename, FBFILE *tofile) { struct stat sb; FILE *fromfile; char *in_buf = 0; int errnum = 0, length = 0; if(!fromfilename || !*fromfilename || !tofile) return 0; if(!(fromfile = fopen(fromfilename, "r+b"))) return 0; errnum = fstat(fromfile->_fileno, &sb); if(errnum < 0 || sb.st_size <= 0) return 0; length = tofile->ptr - tofile->buf; tofile->buf = realloc(tofile->buf, tofile->size + sb.st_size); tofile->ptr = tofile->buf + length; tofile->size += sb.st_size; in_buf = malloc(sb.st_size + 1); in_buf[0] = 0; errnum = fread(in_buf, sb.st_size, 1, fromfile); fbprintf(tofile, "%s", in_buf); fclose(fromfile); free(in_buf); return 1; } -= WAM =- +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST