little problem

hello everyone im new here in forums

i write a small function which call system to execute a command
the input is a ip address
which will send a command to ipblocker.exe to block the given ip

void autoblocknow(TCHAR* m_szIp)

	TCHAR* ip =m_szIp;
	 system("ipblocker.exe block=ip,");

but i wont work =(
ip is not being sent to command
Last edited on
Does opening a command window and typing exactly ipblocker.exe block=ip, work?

That aside, this is not the best way to do this. Your operating system comes with decicated functions meant for just this sort of thing. Using system is expensive and its only advantage is its cross-platform capabilities. Since this code is inherently not cross-platform, relying on the existence of the program ipblocker, you can abandon system and use something better.

What operating system are you using? Windows provides the createprocess function;
im using windows

ipblocker.exe accepts commands like this
ipblocker.exe block=,

function input is an ipaddress

my problem is the input ip is not being sent to command system like the sample above

system("ipblocker.exe block=ip,");

ip is the input ip

im really sorry for poor explanation its my 1st week studying c++
Topic archived. No new replies allowed.