Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
What is wrong with this program?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="jaysonturner" data-source="post: 565911" data-attributes="member: 29088"><p>This program loads in a file via a URL (im doing this so i dont have to host the file for now), gets its html and converts it to a string. I then try and display the string and xcode brings up the bloody debugger.</p><p></p><p>Ive also tried performing other things on the html string, including using range to find substrings, none of them seem to liek the string that is created.</p><p></p><p>[CODE]#import <Foundation/Foundation.h></p><p></p><p>int main (int argc, const char * argv[]) {</p><p> NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];</p><p></p><p> NSData *data = [NSData dataWithContentsOfFile:@"/Users/Jayson/images.html"];</p><p> </p><p> [data writeToFile:@"/Users/Jayson/html.html" atomically:YES];</p><p> </p><p> NSString *theHTML = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];</p><p> </p><p> NSLog(theHTML);</p><p> </p><p> [theHTML release];</p><p> [pool release];</p><p></p><p> return 0;[/CODE]</p><p></p><p>Any help would be grand. Thanks.</p></blockquote><p></p>
[QUOTE="jaysonturner, post: 565911, member: 29088"] This program loads in a file via a URL (im doing this so i dont have to host the file for now), gets its html and converts it to a string. I then try and display the string and xcode brings up the bloody debugger. Ive also tried performing other things on the html string, including using range to find substrings, none of them seem to liek the string that is created. [CODE]#import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSData *data = [NSData dataWithContentsOfFile:@"/Users/Jayson/images.html"]; [data writeToFile:@"/Users/Jayson/html.html" atomically:YES]; NSString *theHTML = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(theHTML); [theHTML release]; [pool release]; return 0;[/CODE] Any help would be grand. Thanks. [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
What is wrong with this program?
Top