[問題] strtok求幫助
s36m開發平台(Platform
[36m開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
無
問題(Question):
我想用strtok把buf上的資料(預計會是401 authorization=>1234)
切成 buf=401 authorization
code=1234
這樣
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
error C2440: '=' : cannot convert from 'char *' to 'char [1024]'
好像是長度不符的關係?
程式碼(Code):(請善用置底文網頁, 記得排版)
程式很長 我擷取一部分有關的來說好了
char code[BUF_SZIE];
char buf[BUF_SZIE];
int main()
{
recvfrom(sClient, buf, BUF_SZIE, 0, (SOCKADDR*)&clientAddr, &nClientLen);
buf=strtok(buf,"=>");
code=strtok(NULL," ");
}
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.230.121.205
→
10/18 19:20, , 1F
10/18 19:20, 1F
→
10/18 19:21, , 2F
10/18 19:21, 2F
→
10/18 19:50, , 3F
10/18 19:50, 3F
→
10/18 19:53, , 4F
10/18 19:53, 4F
→
10/18 19:58, , 5F
10/18 19:58, 5F
→
10/18 20:01, , 6F
10/18 20:01, 6F
→
10/18 20:02, , 7F
10/18 20:02, 7F
→
10/18 20:03, , 8F
10/18 20:03, 8F
→
10/18 20:21, , 9F
10/18 20:21, 9F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章