unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > Programming > C and C++

- Sponsored Advertisement -
http://www.myfpscheats.com/


Reply
 
Thread Tools Display Modes
  #1  
Old 06-15-2007, 12:17 PM
Neo_Reloaded Neo_Reloaded is offline
Tutorial Admin
 
Join Date: Dec 2006
Posts: 259
Default (C) Get root of drive

This function i made because i couldnt find a standard C or C++ function to get the root (like E:\) of the systems drive where windows is installed.

So my version uses the GetWindowsDirectory function to get which drive has windows installed like (E:\Windows\System32\), then strips the (\Windows\System32\) from it and returns to drive letter like this (E:\)

Code:
void driveRoot()
{
	char winRoot[100];
	short int x = 0;
	char driveRoot[4];

	GetSystemDirectory(winRoot,sizeof(winRoot));

	while(winRoot[x] != '\\')
	{
		driveRoot[x] = winRoot[x];
		x++;
	}
	driveRoot[x] = '\\';
	driveRoot[x+1] = NULL; // Add a NULL to end of string
	printf("%s", driveRoot);
}
Reply With Quote
Reply

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit

Tags
drive, root

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 03:13 PM.