Programming using CodeWarrior

I have a question regarding FSSpec in C
I do not know what its structure is??

I need to access a file whose name I know and want to use FSSpec to open it or do any other kind of access with it.

Can we identify the FSSpec of a file which is going to be created on the disk?

It would be helpful if u could give me a site to help me find more details on everything associated to file could be any kind of file.  My file contains image data and is created by a software known as IPLab.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

The_RavenConnect With a Mentor Commented:
FSSpec is a structure that is located in the Files.h file in the Universal Headers (from Apple).

struct FSSpec {
      short            vRefNum;
      long            parID;
      StrFileName  name;

(StrFileName = a Str63 on MacOS)

To fill an FSSpec structure use the following call:

FSMakeFSSpec(short vRefNum,long dirID,
ConstStr255Param fileName,FSSpec *spec);

Use the FSSpec to pass into FSOpen(...)


Hope it helps
AnubaAuthor Commented:
Thank u for ur suggestion, but my question isn't fully answered.  The problem is that I want say the user to decide where that file must be held.  So let's say he decide to create this new file in a directory called A.  Now how does one get the dirID/parID and vRefNum to pass to the function FSMakeFSSpec,  I don't have any idea about that.  

My software must be able to get a filename from the user and then be able to store the images captured in it.  For this I thought of using the StandardGetFile function, but then whatever is the directory or vrefnum must be known or received for me to pass it to FSMakeFSSpec.

Thanks again Raven,
Maybe you should use StandardPutFile instead of StandardGetFile.
StandardFileReply myReply;

StandardPutFile("Save as:", "Default Name", myReply);

if (myReply.sfGood == true)
  FSpCreate(myReply.sfFile, 'ttxt', 'TEXT', smSystemScript);


There is a little sample.
All Courses

From novice to tech pro — start learning today.