我正在尝试从我的微 Controller 发送 AT 命令,并且我正在编写自己的实现来检查远程模块的响应
此时我想通过以下方式将带有命令的字符串发送到模块:
//File.h
//where char const *message is my string from my file.c, LEN the lenght for my message and reply message from the remote module.
uint8_t CommandSenderCheckResponse(char const *message, uint16_t LEN, char const *reply);
---------------
//File.c
#include "File.h"
#define Reply "OK"
uint8_t CommandSenderCheckResponse(char const *message, uint16_t LEN, char const *reply);
{
//something...
}
int main(void)
{
while(1)
{
CommandSenderCheckResponse("AT#TurnSomething=1", LEN, Reply);
}
}
如何获取“AT#TurnSomething=1”的大小?当然,我正在重新发明轮子,您可以向我推荐什么库来发送通用 AT 命令并解析来自模块的响应?
问候
最佳答案
您不需要使用库(比标准库更多)来获取字符串的长度。
int length = strlen(message);
关于c - 如何获取字符串大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51794557/