Boost logo

Boost Users :

Subject: Re: [Boost-users] [ASIO] Resolver question
From: Mark R Stallard (stallard_at_[hidden])
Date: 2016-02-25 08:20:37


John Davies <john.davies_at_[hidden]> wrote:

> If my address is 192.168.1.112 everything works
> If my address is 192.168.001.112 it doesn’t work and throws an exception
> about not finding the host.
>
> It’s not a big deal, but it sure took me a long time to track down.
>
> Is there some sort of Boost magic I can do to convert the bad address
> into a good address?

If you still need to remove leading zeroes from the address, consider
using Boost.Regex (or stdlib regex if you have a C++11 toolset).

The regular expression "\b0+(?=[1-9])" will match one or more leading
zeroes that precede a non-zero digit. Replace each match with an empty
string.

|+| M a r k |+|
                                                                                
  Mark Stallard
  Business Application Services
  Global Business Services Information Technology
  Raytheon Company
                                                                                
                                                                                
                                                                                
                                                                                



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net