Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pallavi0703

macrumors newbie
Original poster
Dec 12, 2007
27
0
Hello All ,
I am building my Xcode(2.4) Carbon project using universal binaries.
I have used HOpenDF call for opening file for reading.
StringPtr voln;
Str255 temp;
c2pstrcpy (temp,lpszfname);
pstrcat(voln, "\p:prj Dir:");
pstrcat(voln, temp);
Err =HOpenDF (0,0,voln,fsRdPerm, &FileRefNo);

It works on mac OS 10.4 but for mac OS 10.5 this api returns error code.
Which is the suitable function call which will work on both OS 10.4 as well as 10.5.
Or whether I need to have Xcode 2.5 version .
Please Reply.

Thanks & Regards ,
Pallavi.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
Hello All ,
I am building my Xcode(2.4) Carbon project using universal binaries.
I have used HOpenDF call for opening file for reading.
StringPtr voln;
Str255 temp;
c2pstrcpy (temp,lpszfname);
pstrcat(voln, "\p:prj Dir:");
pstrcat(voln, temp);
Err =HOpenDF (0,0,voln,fsRdPerm, &FileRefNo);

It works on mac OS 10.4 but for mac OS 10.5 this api returns error code.
Which is the suitable function call which will work on both OS 10.4 as well as 10.5.
Or whether I need to have Xcode 2.5 version .
Please Reply.

Thanks & Regards ,
Pallavi.

When a function returns an error code, it is always helpful to tell us which one. But you are calling pstrcat without having initialized voln, so this is just asking for trouble.
 

pallavi0703

macrumors newbie
Original poster
Dec 12, 2007
27
0
HOpenDF not working on Leopard

Hello gnasher729 ,
Thanks for reply.
I have not send some part of my code .Here is the full code .
OSErr Err;
Str255 temp;
c2pstrcpy (temp,lpszfname);//f1.txt
Str255 VolumeName;
StringPtr voln;
pstrcopy(VolumeName,sPath);//sPath is global variable its current value is "Macintosh HD"
voln = VolumeName;
pstrcat(voln,"\p:prj Dir:");
pstrcat(voln, temp);//temp is f1.txt
//voln has value "Macintosh HD:prj Dir:f1.txt"
Err =HOpenDF (0,0,voln,fsRdPerm, &FileRefNo);
If file is not present it return Err = -43 else if 0 this is on Mac OS 10.4.
Our customer is using Mac 10.5 .So I don't know which Err is Mac 10.5

Ok.
Thanks & Regards ,
Pallavi.
 

pallavi0703

macrumors newbie
Original poster
Dec 12, 2007
27
0
HOpenDF not working on Leopard

Hello ,

Now I am using FSOpenFork instead of HDOpenDF .
Is it Ok for both OS X 10.4 and OS X 10.5.

Please reply,
Thanks,
Pallavi.
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
The headers usually point to when a function will stop working or be available:

Code:
/* This function is deprecated in Mac OS X 10.4. Use FSOpenFork instead.*/
/*
 *  HOpenDF()   *** DEPRECATED ***
 *

So I'm guessing 10.5 drops this function and FSOpenFork is what you should use in 10.4 and 10.5.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.