| PLEX86 | ||
|
help with a jpgfile neededX Server won't start Redhat 9 I'm going crazy here trying to restore the replacement server back into the working order it was previously... (*before* I actually do the replacement!). This is a Redhat 9 system that when... Try a modification of the following. You need to change the method of inputting the search string, and then should change the output to be the string plus remainder of the file. * Leor Zolman * * And heres another throw -- binfsrch.c by CBF * * The difference between a binary and a text file, on read, is the conversion of end-of-line delimiters. What those delimiters are does not affect the action. In some cases the presence of 0x1a EOF markers (MsDos) does. This is a version of Knuth-Morris-Pratt algorithm. The point of using this is to avoid any backtracking in file reading, and thus avoiding any use of buffer arrays. * sizet chrcount;* debuggery, count of input chars, zeroed * * --------------------- * Add money to your Paypal account with OPRAH dT Read this message until the end, and you will find out how the money flows in easy !!!!. Follow the steps and it WILL work. Trust me !!!!!. It's NOT illegal and it is NOT a scam... * Almost straight out of Sedgewick *-* The next array indicates what index in id should next be compared to the current char. Once the (lgh - 1)th char has been successfully compared, the id has been found. The array is formed by comparing id to itself. *void initnext(int *next, const char *id, int lgh) { int i, j; next0 = -1; i = 0; j = -1; i++; j++; nexti = j; } #if (0) printf("id%d = '%c' next%d = %d-n", i, idi, i, nexti); #endif }* initnext * * --------------------- * * reads f without rewinding until either EOF or *marker has been found. Returns EOF if not found. At exit the last matching char has been read, and no further. *int kmpffind(const char *marker, int lgh, int *next, FILE *f) { int j; * char position in marker to check * int ch; * current char * j = 0; chrcount++; j++; } return ch; }* kmpffind * * --------------------- * * Find marker in f, display following printing chars up to some non printing character or EOF *int binfsrch(const char *marker, FILE *f) { int *next; int lgh; int ch; int items; * count of markers found * lgh = strlen(marker); if (!(next = malloc(lgh * sizeof *next))) { puts("No memory"); exit(EXITFAILURE); } else { initnext(next, marker, lgh); items = 0; while (EOF != kmpffind(marker, lgh, next, f)) { * found, take appropriate action * items++; printf("%d %s :, items, marker); while (isprint(ch = getc(f))) { chrcount++; putchar(ch); } puts("-); if (EOF == ch) break; else chrcount++; } free(next); return items; } }* binfsrch * * --------------------- * int main(int argc, char **argv) { FILE *f; f = stdin; if (3 == argc) { if (!(f = fopen(argv2, "rb"))) { printf("Can't open %s-n", argv2); exit(EXITFAILURE); } argc--; } if (2 != argc) { puts("Usage: binfsrch name binaryfile"); puts(" (file defaults to stdin text mode)"); } else if (binfsrch(argv1, f)) { printf("-"%s-" : found-n", argv1); } else printf("-"%s-" : not found-n", argv1); printf("%lu chars-n", (unsigned long)chrcount); return 0; }* main binfsrch * Users Opinion Needed: Dos conundrum I've discovered some interesting problems when I was installing MS-DOS indev-hda1. One of my older system Pentium4 it worked (although it read 100 GIG hard-drive as 1.2 Gig! Furthermore, msdos didn't work... -- Available for consulting-temporary embedded and systems.
|
||||
Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||