Could someone please point me in the right direction with regards to link 'files'. I would like to be able to use the linux c IO to find/query them, along with other data files. they seem to be evading the file radar: the readdir function (dirent.h) is not picking them.
email.removed@4 .ur.protection. com
On a different matter, my thanks to Derrick Coetzee for his sample 'pseudo code' fopen_mkdir. Dodgy as it may be, it was welcome help in my project. Here is my code for it:
email.removed@4 .ur.protection. com
On a different matter, my thanks to Derrick Coetzee for his sample 'pseudo code' fopen_mkdir. Dodgy as it may be, it was welcome help in my project. Here is my code for it:
Code:
#define FULLPERMISSIONS 0x41ff
FILE *fopen_mkdir( char *name, char *mode )
{
char *mname = (char*) malloc( sizeof( char ) * MAXPATH );
DIR *DIRp = 0;
strcpy( mname, name );
int len = 0, i;
while ( mname[ len ] != '\0' ) {
len++;
}
for( i = 0; i < len; i++ ) {
if (( i > 0 ) && ( mname[ i ] == '/')) {
mname[ i ] = '\0'; // read path up to a slash
DIRp = opendir( mname );
if(( mkdir( mname, FULLPERMISSIONS )) && ( !DIRp )) {
// mkdir failed, NOT because dir already exists
fprintf( stdout, " \n *** error opening %s *** \n", mname );
return NULL;
}
if( DIRp ) {
closedir( DIRp );
}
mname[ i ] = '/'; // put it back
}
}
free( mname );
return( fopen( name, mode));
}
Comment