使用 C 解析 URL 的最佳方法? [英] Best ways of parsing a URL using C?
本文介绍了使用 C 解析 URL 的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的网址:
http://192.168.0.1:8080/servlet/rece
我想解析 URL 以获取值:
I want to parse the URL to get the values:
IP: 192.168.0.1
Port: 8080
page: /servlet/rece
我该怎么做?
推荐答案
编写自定义解析器或使用字符串替换函数之一替换分隔符:",然后使用 sscanf()
.
Write a custom parser or use one of the string replace functions to replace the separator ':' and then use sscanf()
.
这篇关于使用 C 解析 URL 的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文