小编KBa*_*art的帖子

将整个代码块转换为C中的一行

比方说,我想将整个代码块输入一个命令:

int k = 0;

for (k = 0; k < 50; k++) 
{
    sprintf(buf, "M LR 10 -10\n");                     //We put the string "M L 10" into the string buffer.
    write(sock, buf, strlen(buf));                     //We send the buffer into the socket.
    memset(buf, 0, 80);                                //Clear the buffer, set buffer to value 0.
    read(sock, buf, 80);                               //Read from the socket to get the results.
    int lme, rme;
    sprintf(buf, "S MELR\n");                          //sensor command to find ME values
    write(sock, buf, strlen(buf));                     //sends the buffer …
Run Code Online (Sandbox Code Playgroud)

c

0
推荐指数
1
解决办法
117
查看次数

标签 统计

c ×1