开发者

read single line from text file in objective-C

I want to read a text file in Objective-C till a specified delimiter For eg:if this is my .txt input file ,

@abc = name1$ 
@xyz = name2$

i want to read abc and assign it in the string variable key,and read name1 till $ and assign it to variable value

for eg:expected output

key = abc
value= name1
key = xyz
value= name2

Kindly suggest开发者_如何学Go me some solution, which functions are available in objective-C, what is its syntax.


Get the -filedescriptor from the NSFileHandle, then use fdopen to retrieve a FILE *, finally use fscanf to read formatted input.

Or, read the whole file into an NSString and -enumerateLinesUsingBlock: to act on each line individually.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜