By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,167 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

i am not getting this program

P: 5
#include<stdio.h>

void main()
{
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Ser vices\\USBSTOR \/v Start \/t REG_DWORD \/d 4 \/f");
}
Sep 23 '10 #1
Share this Question
Share on Google+
5 Replies


Banfa
Expert Mod 5K+
P: 8,916
It is a simple program that makes a call the to reg utility shipped with windows.

Go to a command prompt and type reg to get some simple help on that utility or try a web search.
Sep 23 '10 #2

P: 5
1. is system is a function ?
2. can a function can be called without declaring it ?
3. what is the use of /v,/t,/d,/f in this progrm?
Sep 23 '10 #3

Banfa
Expert Mod 5K+
P: 8,916
system is a standard library function and it is declared in stdlib.h

In C you can call a function without declaring it although it is not advisable.

The /v /t /d /f are command line switches being passed to the reg utility.
Sep 23 '10 #4

100+
P: 687
The only weird thing is escaped forward slash ( \/ ) that is not at least in C++ standard. (...If the character following a backslash is not one of those specified, the
behavior is undefined...). And yes, void main() is also nonstandard.
Sep 24 '10 #5

Expert 100+
P: 2,400
Refer to the sticky post at the front of the C answers forum: PLEASE READ FIRST: Useful Links and Posting Guidelines. The first reply in this thread contains helpful links, including two library references (note the advice that you bookmark those references). Either of those library references will lead you to a manual-page for the system function.

Library function system passes its string argument to the command shell. It is as if you typed that string in a command window. What happens next has nothing to do with C -- it depends on how your system reacts to that command string.
Sep 24 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.