FROM : J. Todd Slack
DATE : Wed Mar 19 19:37:01 2008
Hi Stephen and all,
>> Can anyone explain what I am doing wrong because as far as I can see this
should be valid?
> There are many serious problems with that code. Ignoring the warning, I see:
> 1) That is not the proper way to find the user's documents folder.
<http://developer.apple.com/documentation/Cocoa/Conceptual/>
LowLevelFileMgmt/Tasks/LocatingDirectories.html#//apple_ref/doc/uid/20001279>
** I did not know this, thank you for pointing it out.
> 2) You leak an NSString with the output variable.
> 3) You can't use a "char*" to store the result from encoding with
NSUnicodeStringEncoding
> 4) You can't use strlen() with Unicode characters.
> 5) "%C" is not the correct format specifier for an ASCII character.
> 6) That is not the correct way to combine paths.
> I think you need to stop coding and get some good documents on Unicode and
possibly Cocoa memory management.
After digging deeper, I found that I was indeed encoding wrong and I did not
need to do a lot of the code I posted. Thank yo for pointing out these so
that I did indeed get some clarity. Items 2 and 3 helped the most.
What resources do you recommend? I am not against learning.....<grin>.
But one note, you mentioned stopping coding...if I did that, I would not
have dug to solve the problem...Is there not something to be said for those
that ³try and try again² until they get it right or maybe ³Practice makes
perfect²?
-Jason
DATE : Wed Mar 19 19:37:01 2008
Hi Stephen and all,
>> Can anyone explain what I am doing wrong because as far as I can see this
should be valid?
> There are many serious problems with that code. Ignoring the warning, I see:
> 1) That is not the proper way to find the user's documents folder.
<http://developer.apple.com/documentation/Cocoa/Conceptual/>
LowLevelFileMgmt/Tasks/LocatingDirectories.html#//apple_ref/doc/uid/20001279>
** I did not know this, thank you for pointing it out.
> 2) You leak an NSString with the output variable.
> 3) You can't use a "char*" to store the result from encoding with
NSUnicodeStringEncoding
> 4) You can't use strlen() with Unicode characters.
> 5) "%C" is not the correct format specifier for an ASCII character.
> 6) That is not the correct way to combine paths.
> I think you need to stop coding and get some good documents on Unicode and
possibly Cocoa memory management.
After digging deeper, I found that I was indeed encoding wrong and I did not
need to do a lot of the code I posted. Thank yo for pointing out these so
that I did indeed get some clarity. Items 2 and 3 helped the most.
What resources do you recommend? I am not against learning.....<grin>.
But one note, you mentioned stopping coding...if I did that, I would not
have dug to solve the problem...Is there not something to be said for those
that ³try and try again² until they get it right or maybe ³Practice makes
perfect²?
-Jason
| Related mails | Author | Date |
|---|---|---|
| J. Todd Slack | Mar 19, 18:10 | |
| Nick Zitzmann | Mar 19, 18:16 | |
| David Duncan | Mar 19, 18:20 | |
| J. Todd Slack | Mar 19, 18:23 | |
| J. Todd Slack | Mar 19, 18:24 | |
| stephen joseph but… | Mar 19, 18:26 | |
| J. Todd Slack | Mar 19, 19:37 |






Cocoa mail archive

