作者:imjob1234_34706 | 来源:互联网 | 2023-09-24 09:50
I have the char
我有炭
char test[] = "Hello there\n"
"World, my name\n"
"Is bob\n";
Is there a function where I can use to store each line into a different char array. So the \n
would indicate for me to stop, and store it into a new array? So in the end I would have 3 sets of char arrays. Essentially is there a function which I can use to find the \n
, then copy everything before it, but then stop copying if it sees a \n
是否有一个函数,我可以用来将每一行存储到一个不同的char数组。那么\ n会指示我停下来,并将其存储到一个新的数组中?所以最后我会有3组char数组。本质上是有一个函数,我可以用来找到\ n,然后复制它之前的所有内容,但如果它看到\ n然后停止复制\ n
char line1[] = "Hello there\n";
char line2[] = "World, my name\n";
char line3[] = "Is bob\n";
1 个解决方案