开发者

How to read "a b.txt" in bundle directory iOS

开发者 https://www.devze.com 2023-04-03 23:43 出处:网络
I hav开发者_StackOverflow社区e a problem right now. I want to read content of file which one have space in file name like \"a b.txt\" in budle directory. How to do that?

I hav开发者_StackOverflow社区e a problem right now. I want to read content of file which one have space in file name like "a b.txt" in budle directory. How to do that?

Thanks before. Regards.


NSString* filePath= [[NSBundle mainBundle] pathForResource:@"a b" ofType:@"txt"];
NSString* txt= [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];

The space in the filename should not cause a problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号