简体   繁体   中英

Cross-Platform C++ Parser Library

What would a good cross-platform C++ parser for use on a space and tab delimited txt file? I am looking to parse the file and then output a new txt file based off the parsed info.

The input file contains details for a network traffic script with several columns such as Host IP Address, Host Interface, Subnet, etc.

I need to take the information from the input file and create the traffic script in the format that another application requires.

Here is an example of the format for the input file:

Hostname    HostIP Area    Host Interface   Number of Routes
test1    128.1.1.1 0.0.0.0       128.100.1.1       100   
test1    128.1.1.2 0.0.0.0
test1    128.1.1.3 0.0.0.0
test2    128.2.2.4 0.0.0.0       128.200.5.6       100
test2    128.2.2.5 0.0.0.0
test2    128.2.2.6 0.0.0.0

I am asking for a library that would be ideal to parse this type of data and create a new text file.

For a simple input file like the example you've give, you could write your own just for this file type. You can use the standard C++ classes and build your own file interpreter. Here's a great guide:

http://www.cplusplus.com/doc/tutorial/files

Boost may be a solution. If you simply wish to split data based on spaces and tabs, check out boost::split .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM