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

  1. Path: sparky!uunet!spool.mu.edu!yale.edu!jvnc.net!netnews.upenn.edu!netnews.noc.drexel.edu!king.mcs.drexel.edu!udsugar
  2. From: udsugar@mcs.drexel.edu (David Sugar)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Help, PBHCopyFile..
  5. Message-ID: <1993Jan3.081158.3294@mcs.drexel.edu>
  6. Date: 3 Jan 93 08:11:58 GMT
  7. Distribution: usa
  8. Organization: Drexel University, Dept. of Math. and Comp. Sci.
  9. Lines: 53
  10.  
  11.  
  12. I am trying to copy a file with PBHCopyFile, and it seems like it 
  13. should be simple enough, but I keep getting the error -50, Error In
  14. User Parameter List (which isn't helping to much).
  15.  
  16. Anyway, I have a HParamBlockPtr and set the copyParam to the
  17. following, the ioCompletion to NIL, the ioVRefNum to the source
  18. vRefNum (-1 in this case), the ioDirID to the source directory
  19. ID (129 in this case), the ioNamePtr to my name.
  20.  
  21. Then set ioDstVRefNum to the destination refNum (again -1)
  22. the ioNewDirID to the new directory ID (19 in this case)
  23. and the ioNewName to the filename (which is the same name
  24. as the ioNamePtr pointed to. 
  25.  
  26. I set ioCopyName to NIL and the call the PBHCopyFile.  It
  27. always gives the error -50.  I'm not quite sure what I've
  28. missed.  I'll include the code I'm routine I working with,
  29. maybe it will help.
  30.  
  31.  
  32. void CopyFile (CFile *source, CFile *dest)
  33. {
  34.     HParamBlockRec    copy_data;
  35.     OSErr            err;
  36.     
  37.     if (dest->ExistsOnDisk ())
  38.         dest->ThrowOut ();
  39.  
  40.     copy_data.copyParam.ioCompletion = NILP;
  41.     copy_data.copyParam.ioNamePtr = source->name;
  42.  
  43.     copy_data.copyParam.ioVRefNum = source->volNum;
  44.     copy_data.copyParam.ioDirID = source->dirID;
  45.     
  46.     copy_data.copyParam.ioNewName = source->name;
  47.     copy_data.copyParam.ioDstVRefNum = dest->volNum;
  48.     copy_data.copyParam.ioNewDirID = dest->dirID;
  49.     
  50.     copy_data.copyParam.ioCopyName = NILP;
  51.     err = PBHCopyFile (©_data, FALSE);
  52.  
  53. }
  54.  
  55. I am sure that the fields data fields of source and data are
  56. correct when the call is made, so that isn't a problem..
  57.  
  58.  
  59. Thanks
  60.  
  61.  
  62. Dave Sugar
  63. udsugar@mcs.drexel.edu
  64.