Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-26-2010, 12:23 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 54
warrior is on a distinguished road
Default How to convert nsstring to cString?

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.
warrior is offline   Reply With Quote
Old 10-26-2010, 02:03 AM   #2 (permalink)
Pro. Game Developer
iPhone Dev SDK Supporter
 
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,176
Kalimba is on a distinguished road
Default

Quote:
Originally Posted by warrior View Post
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.
What have you tried? And what works and what doesn't work?
__________________
~~ Word Flurry ~~ App Store / Website / Facebook
Kalimba is offline   Reply With Quote
Old 10-26-2010, 02:05 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 54
warrior is on a distinguished road
Default

Quote:
Originally Posted by Kalimba View Post
What have you tried? And what works and what doesn't work?
when i tried to read the wave file the output is always caff, so i dont understand which is working or not working. I want to check my concept of opening is right or wrong.
warrior is offline   Reply With Quote
Old 10-26-2010, 08:59 AM   #4 (permalink)
Pro. Game Developer
iPhone Dev SDK Supporter
 
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,176
Kalimba is on a distinguished road
Default

Quote:
Originally Posted by warrior View Post
when i tried to read the wave file the output is always caff, so i dont understand which is working or not working. I want to check my concept of opening is right or wrong.
I don't understand this response. Whether the conversion from NSString to C-string in the filename is working or not won't change a file's contents from WAV to CAF.
__________________
~~ Word Flurry ~~ App Store / Website / Facebook
Kalimba is offline   Reply With Quote
Reply

Bookmarks

Tags
c language, iphone, string-conversion

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 332
14 members and 318 guests
7twenty7, chiataytuday, condor304, Creativ, Domele, dreamdash3, laureix68, LEARN2MAKE, mistergreen2011, mottdog, palme2elie, Paul Slocum, schmallegory
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,660
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, laureix68
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:19 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0