开发者

Does char array contain string?

I have a text file and would like to check if it contains开发者_高级运维 a string. The text file is stored in a char array: char buffer[512][128];.

Q1: Is it easier if I buffer it in one long array instead of a multidimensional array? Q2: How could I check whether the buffer contains the string char *s1 = "Hello world!";? I will need to search for multiple strings.


  1. It will be much easier to use a single 1D array.

  2. strstr(buffer, s1) != null (once you've changed buffer into a 1D array)


strstr

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜