|
-
December 18th, 2008, 07:21 AM
#1
Getting and Setting current Directory
void main() {
char olddir[MAX_PATH];
if (GetCurrentDirectory(MAX_PATH, olddir) == 0) {
errormessage();
//exit(1);
}
MessageBox(NULL,olddir,L"File",MB_OK);
_tprintf(TEXT("Current Directory %s\n"),olddir);
if(SetCurrentDirectory("C:\\Documents and settings") == 0)
errormessage();
if (GetCurrentDirectory(MAX_PATH, olddir) == 0) {
errormessage();
}
_tprintf(TEXT("Current Directory %s\n"),olddir);
getch();
}
I have been using this code to get and set my current directory but when setting the directory it always displays the error "The System can't find the file specified"
while getting the file it displays this as the current directory
Current Directory c:\Documents and Settings\Administrator\My Documents\Visual St
udio 2005\Projects\Scorta\TEST
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
|