|
-
March 26th, 2010, 05:32 PM
#1
Read a text file and echo something if text exists?
Hello, I am trying to make it so when you enter a new line in a text file like this format:
ThisIsPlayersName 127.0.0.1
If the text you entered into the textbox matches either the IP or ThisIsPlayerName it echos the players name matching the ip, when it reads the text file it would be on a webhost e.g
www.example.com/banlist.txt
Could anybody help me do this?, Thanks.
-
March 27th, 2010, 01:56 PM
#2
Re: Read a text file and echo something if text exists?
where's the text box? do you enter a new line in the text box, or the web-hosted file?
-
March 28th, 2010, 09:31 AM
#3
Re: Read a text file and echo something if text exists?
Code:
#include <windows.h>
#include <stdio.h>
#include <iostream.h>
int main() {
string StringToRead;
char Playername[80], ip[80];
StringToRead = "Playername 127.0.0.1";
strcpy(Playername, strtok((char*)StringToRead.c_str(), " ")); /* strtok basicly splits the string with
the by you choses delimiter. */
strcpy(ip, strtok(NULL, "")); /* This makes the variable 'ip' hold the leftover of
the last time we strtok'd. */
cout << Playername << endl;
cout << ip << endl;
return cin.get();
}
This might help you o_o
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|