C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 13th, 2006, 09:48 AM
jaro jaro is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 35 jaro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 6 h 16 m 44 sec
Reputation Power: 4
Send a message via Yahoo to jaro
Registry question

hi there!
i'm just wondering is it possible to write a function in C that will create a System Variable with its corresponding value (without causing for a system restart)?
regards,
jaro

Reply With Quote
  #2  
Old February 13th, 2006, 11:55 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 997 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 14 h 26 m 27 sec
Reputation Power: 5
Send a message via ICQ to Itsacon
That function already exists...

try typing 'SET' or 'SET /?' in a cmd prompt

To summarise: type 'SET variable=value' will set system variable 'variable' to value 'value'.

You can do this from C with the 'system()' function.
__________________
This is my code. Is it not nifty?

"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams


Join the Itsacon fanclub!    
Zero Tolerance: Spammers banned so far: 280

Reply With Quote
  #3  
Old February 14th, 2006, 01:39 AM
jaro jaro is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 35 jaro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 6 h 16 m 44 sec
Reputation Power: 4
Send a message via Yahoo to jaro
thanks Itsacon,

I did try what you said, but when i try to check the system variable that i've made (using the cmd window) i did'nt see it. i've check it using the Computer icon. sorry for my english

regards,
jaro

Reply With Quote
  #4  
Old February 14th, 2006, 04:06 AM
Icon's Avatar
Icon Icon is offline
Command Line Warrior
Click here for more information. Click here for more information
 
Join Date: Sep 2005
Posts: 735 Icon User rank is Private First Class (20 - 50 Reputation Level)Icon User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 3 Days 12 h 16 m 2 sec
Reputation Power: 4
An environment variable is not the same as a system variable. Usually (I used these more on *nix machines than windows) environment variables only live as long as *drumroll* your process(/shell) environment.. On linux you can EXPORT (bash) your env variable, although after a reboot they will be gone again. Am not sure how to do it on windows, sorry.

I believe SET just sets an environment variable.

Reply With Quote
  #5  
Old February 14th, 2006, 04:33 AM
Cirus Cirus is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 276 Cirus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 11 h 48 m 58 sec
Reputation Power: 4
Quote:
Originally Posted by jaro
hi there!
i'm just wondering is it possible to write a function in C that will create a System Variable with its corresponding value (without causing for a system restart)?
regards,
jaro


If you are using the environment of VC++, then in Visual Studio there are many funcitions starting with WriteRegKeyXXXX for changing registry values. In Visual Studio environment you can use C code to affect registry variables without restarting.

For Kernal Level variables it is however important to reboot your system as changes won't be seen unless restarted.

Reply With Quote
  #6  
Old February 15th, 2006, 01:00 AM
jaro jaro is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 35 jaro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 6 h 16 m 44 sec
Reputation Power: 4
Send a message via Yahoo to jaro
Smile

thanks Itsacon and Cirus.
it help me make sense on what I'm currently working on..

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Registry question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT