1

How do I read the contents of .doc file [not from resource file] into NSString in Objective-C?

I tried doing it in this way:

NSString *str = [NSString stringWithContentsOfFile:@"/User/home/Documents/config.doc"]; NSLog(@"Contents of file : %@",str); 

OUTPUT: -+-% [encoded format]

output is in encoded format

How do I solve this problem? Is it not reading from file the proper contents or am I printing it wrong?

Thank You.

1 Answer 1

2

The file you are using is probably binary, so when viewed as a string it will not work like you think. You would need some sort of library or decoding function that would parse and display a binary .doc file.

Though you may have more luck with a .docx file which I believe is an XML based format that Word can save.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.