开发者

read a '\n' (newline) terminated string using windows via C

is it possible to read a random length string , terminated by a newline, using C only and not C++? ive been trying to find examples but cant seem to find any using win开发者_运维百科dows that uses this. i can accomplish reading data off the serial port but the problem is that these are random in length. there only common factor is that these strings are terminated by newlines. thank you very much


Not trivially. Call fgets in a loop until you hit a newline, holding onto each buffer you read up to that point.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜