shwaip
24 Mar 2004, 8:08am
For one of my classes, we need to write a shell to access information on a floppy, and implement several commands (ls, cp, etc.)
I need help with the following:
the current directory is stored in memory, pointed to by the global variable CURRENT_DIRECTORY, and one of the things I am doing requires me to truncate it:
ex:
//at very top of code
char* CURRENT_DIRECTORY;
//later on, space is allocated
(value of CURRENT_DIRECTORY)
/DIR1/DIR2/DIR3
I want to remove "/DIR3", leaving CURRENT_DIRECTORY pointing to /DIR1/DIR2
it is fine if CURRENT_DIRECTORY points to /DIR1/DIR2\0 (string termination char)
thx
I need help with the following:
the current directory is stored in memory, pointed to by the global variable CURRENT_DIRECTORY, and one of the things I am doing requires me to truncate it:
ex:
//at very top of code
char* CURRENT_DIRECTORY;
//later on, space is allocated
(value of CURRENT_DIRECTORY)
/DIR1/DIR2/DIR3
I want to remove "/DIR3", leaving CURRENT_DIRECTORY pointing to /DIR1/DIR2
it is fine if CURRENT_DIRECTORY points to /DIR1/DIR2\0 (string termination char)
thx