Getting ip + port from file
Hello, I want to get ip + port from file into different variables.
By that I mean, i have a file called "ips.txt" and on first line, its: 1.1.1.1:27015 I want to get 1.1.1.1 into a variable let's say ip and 27015 into variable port. So ip = 1.1.1.1 port = 27015 Note that i will have more than one ip in file. an example: 1.1.1.1:27015 1.2.3.4:27055 PHP Code:
|
Re: Getting ip + port from file
I would use strtok().
Out of curiosity, what are you using the IPs for? I can't think of any good use for an IP. |
Re: Getting ip + port from file
Quote:
Hmm, Im doing it purely for experience. Im still learning and i want to improve. |
Re: Getting ip + port from file
Quote:
It's such a small function that a tutorial would not be appropriate for that function alone. However, the function is well documented in the include files: http://hg.alliedmods.net/amxmodx-cen...tring.inc#l154 If you are trying to learn, I suggest that you don't do anything with IPs (because there is no good use for them). If you want to work with something that uniquely identifies a player, work with SteamIDs. |
| All times are GMT -4. The time now is 15:47. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.