请问大家怎么过滤socket中接收的内容?

BAO BAO 2017-09-22 09:09:23
recv(sClient,revData,BUFSIZ,0)

revData内容其实是 一个网页的内容
我想检测网页中的一个数值 (总计余额:0)我想查询这个数字是否大于0
该怎么写代码过滤啊

while(recv(sClient,revData,BUFSIZ,0)>0){
过滤;
}

...全文
417 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2017-09-26
  • 打赏
  • 举报
回复
引用 4 楼 wqte45 的回复:
怎么解析html啊,有好的方法吗
百度搜相关关键字。
BAO BAO 2017-09-26
  • 打赏
  • 举报
回复
怎么解析html啊,有好的方法吗
xian_wwq 2017-09-25
  • 打赏
  • 举报
回复
要过滤也先得解析 socket其实只认识byte[],至于byte[]是什么数据, 是否需要过滤, 那是业务层的事情
自信男孩 2017-09-25
  • 打赏
  • 举报
回复
使用字符串解析函数,首先根据页面即http格式,一段段解析。比如使用strstr,strchr等等字符串处理函数
赵4老师 2017-09-25
  • 打赏
  • 举报
回复
memchr Finds characters in a buffer. void *memchr( const void *buf, int c, size_t count ); Routine Required Header Compatibility memchr <memory.h> or <string.h> ANSI, Win 95, Win NT For additional compatibility information, see Compatibility in the Introduction. Libraries LIBC.LIB Single thread static library, retail version LIBCMT.LIB Multithread static library, retail version MSVCRT.LIB Import library for MSVCRT.DLL, retail version Return Value If successful, memchr returns a pointer to the first location of c in buf. Otherwise it returns NULL. Parameters buf Pointer to buffer c Character to look for count Number of characters to check Remarks The memchr function looks for the first occurrence of c in the first count bytes of buf. It stops when it finds c or when it has checked the first count bytes. Example /* MEMCHR.C */ #include <memory.h> #include <stdio.h> int ch = 'r'; char str[] = "lazy"; char string[] = "The quick brown dog jumps over the lazy fox"; char fmt1[] = " 1 2 3 4 5"; char fmt2[] = "12345678901234567890123456789012345678901234567890"; void main( void ) { char *pdest; int result; printf( "String to be searched:\n\t\t%s\n", string ); printf( "\t\t%s\n\t\t%s\n\n", fmt1, fmt2 ); printf( "Search char:\t%c\n", ch ); pdest = memchr( string, ch, sizeof( string ) ); result = pdest - string + 1; if( pdest != NULL ) printf( "Result:\t\t%c found at position %d\n\n", ch, result ); else printf( "Result:\t\t%c not found\n" ); } Output String to be searched: The quick brown dog jumps over the lazy fox 1 2 3 4 5 12345678901234567890123456789012345678901234567890 Search char: r Result: r found at position 12 Buffer Manipulation Routines See Also _memccpy, memcmp, memcpy, memset, strchr

69,364

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧