dauter@terminator.cc.umich.edu (Michael Dautermann) (05/20/91)
Hello... Up until three or so weeks ago, if someone had told me I would be actually WRITING programs for the mac, I probably would have laughed out loud... amazingly enough, one of the departments at U-M has hired me to do MPW-C programming (yes.. MPW..) and I feel like I've learned 1000% more about interfaces, design, and the C language in general ever since I started... I'm having a problem in the benchmarking program I'm writing, though.. What follows is a listing of a function that I'm using to create 100+ empty files within a folder that is also created from within the program. When I call PBOpenWD, I crash out with a -37 system error (bad file name) or sometimes also -43, file not found. It might have something to do with Multifinder, but I'm not sure... I have no idea what a ioWDProcID is, either (and I can't find any helpful hints from the tech notes I've looked over)... Would somebody take a few seconds and look at this code and let me know what I am doing wrong? Thanks so much for any help... Michael... ------ void TestProcess( void ) { long timestart, timefinish; /* the time of testing... */ Point where = {40, 40}; /* where shall we write these files? */ Str255 origName = "\pTest Folder", filename; SFReply reply; HParamBlockRec paramBlock; WDPBRec wdBlock; short x; /* first thing we want to do is define where we are to perform the test... */ SFPutFile( where, "\pWhere shall we test?", origName, nil, &reply) ; if ( reply.good == false ) return; paramBlock.fileParam.ioVRefNum = reply.vRefNum; paramBlock.fileParam.ioCompletion = nil; paramBlock.fileParam.ioNamePtr = reply.fName; paramBlock.fileParam.ioDirID = 0; if ( PBDirCreate (¶mBlock, false) != noErr) { DebugStr( "\pdamnnumberbooboo" ); ExitToShell(); } wdBlock.ioCompletion = nil; wdBlock.ioWDProcID = paramBlock.fileParam.ioDirID ; wdBlock.ioVRefNum = paramBlock.fileParam.ioVRefNum; wdBlock.ioWDDirID = paramBlock.fileParam.ioDirID; wdBlock.ioNamePtr = filename; wdBlock.ioWDIndex = 0; wdBlock.ioWDVRefNum = reply.vRefNum; if ( PBOpenWD( &wdBlock, false ) != noErr) { DebugStr( "\pcantdoPBopenWD" ); ExitToShell(); } if ( PBGetWDInfo( &wdBlock, false) != noErr) { DebugStr( "\pcantdoPBgetinfoWD" ); ExitToShell(); } if ( highlights.crfilesonoff == on ) { strcpy( filename+1, "test" ); for ( x = 0; x < preferences.numbertocreate; x++) { itoa ( x, filename+5 ); filename[0] = strlen( filename+1 ); if ( Create( filename, wdBlock.ioVRefNum, 'elvs', 'live' ) != noErr) { DebugStr( "\pdamncreatefilesbooboo" ); ExitToShell(); } } } } -- ----------------------------------------------------------------- Mike @ ccs.itd.umich.edu ( ( ( ( (( in stereo )) ) ) ) ) Mike Dautermann - U-M Ann Arbor, Dearborn and the WORLD!!