views:

49

answers:

1

I have a nsstring(filePath),which has the path to the audio file.I want open the audio file, so i want to convert the nsstring to Cstring.

  fopen([filePath cStringUsingEncoding:1], "r");

is the above line is correct or not,because i can also use fopen([filePath cString], "r");, In some websites it is mentioned to use UTF8stringEncoding.Which is the the right NSString to string conversion.Please help me out.Thanks.

+3  A: 

Use UTF8String:

fopen([filePath UTF8String], "r");
Jacob Relkin
can i know the difference between your answer and what i used.how to checking whether it is working fine?
Warrior
@Warrior, I think that reading the documentation will clear up any qualms you may have.
Jacob Relkin
@jacob , are you know how to convert audio file in Nsdata i use export session but is always failed
GhostRider