Firstly hello all!
I am writing an audit tool for a pet project to pass away the boredom at work (and so in future I just run the program and save hours of work)
What I am trying to do is read in an IP address and then based on the subnet mask do calculations on the correct octect
e.g. 192.168.2.60 with a 23 bit mask I would start my calculations on the 3rd octect (2).
What I want to do is this. Let the user input the address and then read each octect into seperate integer values so that
The intial variable is a string but how do I scan for each of the elements. I would suspect the best way would be to search for the first to scan until the . then after the . for the next 3. Can anyone show me how to do this please?
The code I have works but only if the user inputs the last octect (thus limiting me to calculations on 24 to 32 bit masks)
Any help greatly appreciated. By the way I am using a gcc compiler so I can port over to any gcc platform.