From: jerry AT jvdsys DOT textlitho DOT nl (Jerry van Dijk) Date: Mon Nov 21, 1994 20:48:36 GMT Subject: fnmerge bug ? To: djgpp AT sun DOT soe DOT clarkson DOT edu Hi, Is the following proper behaviour for fnmerge ? >----------------------- cut --------------------------------< // Test the fnmerge() and fnsplit functions in C++ #include #include #include const char* TESTPATH = "test.tst"; int main() { int flags; char* ptr; char ext[MAXEXT]; char path[MAXPATH]; char name[MAXFILE]; char dir[MAXDIR], def_dir[MAXDIR]; char drive[MAXDRIVE], def_drive[MAXDRIVE]; // Split a path into its components flags = fnsplit( TESTPATH, drive, dir, name, ext ); // Display results cout << endl << "Result of splitting " << TESTPATH << endl << endl; // Display drive results cout << "DRIVE - expected: FLAGS=F, VALUE=" << endl; cout << " result: FLAGS="; ( flags & DRIVE ) ? cout << 'T' : cout << 'F'; cout << ", VALUE=" << drive << endl << endl; // Display dir results cout << "DIR - expected: FLAGS=F, VALUE=" << endl; cout << " result: FLAGS="; ( flags & DIRECTORY ) ? cout << 'T' : cout << 'F'; cout << ", VALUE=" << dir << endl << endl; // Display name results cout << "NAME - expected: FLAGS=T, VALUE=test" << endl; cout << " result: FLAGS="; ( flags & FILENAME ) ? cout << 'T' : cout << 'F'; cout << ", VALUE=" << name << endl << endl; // Display extension results cout << "EXT - expected: FLAGS=T, VALUE=.tst" << endl; cout << " result: FLAGS="; ( flags & EXTENSION ) ? cout << 'T' : cout << 'F'; cout << ", VALUE=" << ext << endl << endl; // Get default drive strcpy( def_drive, "a:" ); *def_drive = ( getdisk() + 'a' ); // Display default drive cout << "The default drive is " << def_drive << endl << endl; // Get working directory if ( !getcwd( def_dir, MAXDIR ) ) { cout << "*** Error reading working directory" << endl; return 1; } // Display working directory cout << "The raw working directory is " << def_dir << endl; // Remove drive from directory string strcpy( def_dir, def_dir+2 ); #ifdef PATCH // Define to make it work properly // Replace slashes by backslash ptr = def_dir; while ( *ptr ) { if ( *ptr == '/' ) *ptr = '\\'; ++ptr; } // Add terminating backslash strcat( def_dir, "\\" ); #endif // Display working directory *without* drive specifier cout << "The normal working directory is " << def_dir << endl << endl; // Rebuilding path fnmerge( path, def_drive, def_dir, name, ext ); // Display new path cout << "The rebuild path is: " << path << endl << endl; // Done return 0; } >----------------------- cut --------------------------------< It looks like fnmerge doesn't add the last slash between directory and filename. Is that as things are supposed to be ? Salutem, Jerry... +----------------------------------------------------------+ | Jerry van Dijk Fidonet: 2:281/202.3 | | jerry AT jvdsys DOT textlitho DOT nl Compuserve: 100115,1651 | +----------------------------------------------------------+