[英]convert text hex to real hex representation C++
I have the following file format | 我有以下文件格式| 00 00 07 09 | 00 00 07 09 | for example in a text file I need for a way to parse it so that each time I find a string between "|" 例如在文本文件中,我需要一种解析它的方法,以便每次我在“ |”之间找到一个字符串 convert the inside to real hex representation 将内部转换为真实的十六进制表示
for instance | 例如 30 | 30 | will give me 0 how can it be done in C++ (damn C# makes you so lazy and dump). 会给我0,如何用C ++来完成(该死的C#使您如此懒惰和转储)。
this is the common format of the file 这是文件的通用格式
+++ath +++ ATH
|FF F4 FF FD 06| | FF F4 FF FD 06 |
/viewsource/template.html? /viewsource/template.html?
NAMENAME NAMENAME
|FF FF FF FF FF FF| | FF FF FF FF FF FF |
|13| | 13 |
|05| | 05 |
|00 00 00 08| | 00 00 00 08 |
|00| | 00 |
|0A| | 0A |
|00 00| | 00 00 |
c|82|Sc ç| 82 |钪
= =
GET 得到
FTP|3A|/ FTP | 3A | /
|01 06 00 00 00| | 01 06 00 00 00 |
HTTP/ HTTP /
PROPFIND PROPFIND
each line will be saved in a vector array that will be passed to the following function. 每一行都将保存在一个矢量数组中,该数组将传递给以下函数。
void WuManber::Initialize( const vector<const char *> &patterns,
bool bCaseSensitive, bool bIncludeSpecialCharacters, bool bIncludeExtendedAscii )
use stringstream 使用stringstream
#include <sstream>
using namespace std;
void foo()
{
istringstream ss("30");
int i;
ss >> hex >> i;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.