home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18540 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.5 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!caen!rphroy!ilium!sycom!pam-sy!paulm
  2. From: paulm@pam-sy.UUCP (Paul C. Mrozowski)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: SEEKing to EOF
  5. Message-ID: <paulm.02tb@pam-sy.UUCP>
  6. Date: 11 Jan 93 23:52:48 GMT
  7. Organization: None
  8. Lines: 53
  9. X-NewsSoftware: GRn 1.16f (10.17.92) by Mike Schwartz & Michael B. Smith
  10.  
  11.  
  12.   Hopefully someone here can answer a simple (?) question (or maybe just 
  13. a dumb question). I'm writing a small program that's supposed to open
  14. a file, read in some information, and write out this info. to a second
  15. file (appending it to the second file). Everything seems to work, right
  16. until I do the FPuts, then the program bombs. Here's some of the code:
  17.  
  18.   (misc includes, and opening of both files).
  19.  
  20.  
  21.  
  22. j = Seek(file_handle2, 0, OFFSET_END);     /* Move to the EOF() */
  23. for( ; ; )
  24. {
  25.     
  26. buffer = FGets(file_handle, line, NUM);
  27.  
  28.     if(buffer == NULL)
  29.     {
  30.         Close(file_handle);    
  31.                 Close(file_handle2);  
  32.         Exit(0);
  33.     }
  34.     
  35. p = strstr(buffer,string);
  36.  
  37.     if(p != NULL) break;
  38.  
  39. }
  40.  
  41. p=p+sizeof(string);
  42. strcpy(newstr,"Rename ");
  43. strcat(newstr, "1439");
  44. strcat(newstr, p);
  45.  
  46. printf(newstr);
  47. i = FPuts(file_handle2, newstr);       /* Program bombs right here */
  48.  
  49.  
  50.   I have a feeling I'm missing something obvious, but I'm not sure what.
  51. Any suggestions?
  52.  
  53.  
  54. Paul
  55.  
  56. -- 
  57.  
  58. paulm%pam-sy%sycom@ilium.troy.msen.com
  59. ---
  60.    Paul Mrozowski             |  "You can have anything you want but
  61.    NetMail: paulm@pam-sy.uucp    |   you'd better not take it from me"-GNR
  62.  
  63.      IBM Logic: "Keyboard Failure, press <F1> to continue..."
  64.