Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!think.com!mintaka!ogicse!milton!blake.u.washington.edu!mm From: mm@blake.u.washington.edu (Eric Gorr) Newsgroups: comp.sys.mac.programmer Subject: Need help again... Message-ID: <12752@milton.u.washington.edu> Date: 11 Dec 90 03:26:44 GMT Sender: news@milton.u.washington.edu Distribution: usa Organization: University of Washington, Seattle Lines: 56 Could someone please make this work? Basically, I am creating a text file called "Test" and attempting to write "This is a test..." to the file. The problem with the code (at least I am 99% sure), is when I attempt to use the Toolbox routines to make,write to, read from and print the data from the file. I am using THINK C (Lightspeed C)... TestAdd () { OSErr Err; char Name[6], *DataString, *StartPtr, *TheData; long BTW; int RefNum; strcpy (Name, "\pTest"); MoveTo (100,100); DrawString (Name); DataString = "\pThis is a test..."; MoveTo (150,150); DrawString (DataString); /* I am fairly sure this is where the problem code starts */ Err = Create (Name, vRefNum, 'MACA', 'TEXT'); Err = FSOpen (Name, vRefNum, RefNum); BTW = sizeof (DataString); StartPtr = &DataString [0]; Err = FSWrite (RefNum, BTW, StartPtr); Err = FSClose (RefNum); Err = FlushVol (Nil_Pointer, vRefNum); Err = FSOpen (Name, vRefNum, RefNum); Err = FSRead (RefNum, BTW, TheData); Err = FSClose (RefNum); MoveTo (180,180); DrawString (TheData); } Thanx... ------------------------------------------------------------------------------ Mystery_Man ! All warfare is based on deception - Sun Tzu ! Diplomacy is the art of letting someone else have mm@ ! your war - Danielle Vare' blake.u.washington.edu! He who knows when he can fight and when he cannot will ! be victorious - Sun Tzu IBM - I Bought ! Alway mystify, mislead, and surprise the enemy Macintosh ! - Stonewall Jackson ------------------------------------------------------------------------------