home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!caen!rphroy!ilium!sycom!pam-sy!paulm
- From: paulm@pam-sy.UUCP (Paul C. Mrozowski)
- Newsgroups: comp.sys.amiga.programmer
- Subject: SEEKing to EOF
- Message-ID: <paulm.02tb@pam-sy.UUCP>
- Date: 11 Jan 93 23:52:48 GMT
- Organization: None
- Lines: 53
- X-NewsSoftware: GRn 1.16f (10.17.92) by Mike Schwartz & Michael B. Smith
-
-
- Hopefully someone here can answer a simple (?) question (or maybe just
- a dumb question). I'm writing a small program that's supposed to open
- a file, read in some information, and write out this info. to a second
- file (appending it to the second file). Everything seems to work, right
- until I do the FPuts, then the program bombs. Here's some of the code:
-
- (misc includes, and opening of both files).
-
-
-
- j = Seek(file_handle2, 0, OFFSET_END); /* Move to the EOF() */
- for( ; ; )
- {
-
- buffer = FGets(file_handle, line, NUM);
-
- if(buffer == NULL)
- {
- Close(file_handle);
- Close(file_handle2);
- Exit(0);
- }
-
- p = strstr(buffer,string);
-
- if(p != NULL) break;
-
- }
-
- p=p+sizeof(string);
- strcpy(newstr,"Rename ");
- strcat(newstr, "1439");
- strcat(newstr, p);
-
- printf(newstr);
- i = FPuts(file_handle2, newstr); /* Program bombs right here */
-
-
- I have a feeling I'm missing something obvious, but I'm not sure what.
- Any suggestions?
-
-
- Paul
-
- --
-
- paulm%pam-sy%sycom@ilium.troy.msen.com
- ---
- Paul Mrozowski | "You can have anything you want but
- NetMail: paulm@pam-sy.uucp | you'd better not take it from me"-GNR
-
- IBM Logic: "Keyboard Failure, press <F1> to continue..."
-