S
Saket
Hello All,
I am want to open a file in C language where in i know the location of
the file, but do not know its name.
For this what i have done is: -
1) Used system command like and listed all the files at the location
(using ls) and stored the output in another file at a different
location.
2) Then i open this new file (created after ls) and read it line by
line. All these lines will have the name of the files which needs to
be pened by me.
3) Then I concatenate this file name with the location of the file
(and put it in a variable say absolutefilename) resulting in the
absolute file name i.e. /absolute-path/filename
4) I then try to open this file by passing variable absolutefilename
to fopen function.
But file does not open. When i give the file name statically to th
fopen function at design-time file opens.
Please help on this.
Thanx a ton in advance.
Regards,
Saket
I am want to open a file in C language where in i know the location of
the file, but do not know its name.
For this what i have done is: -
1) Used system command like and listed all the files at the location
(using ls) and stored the output in another file at a different
location.
2) Then i open this new file (created after ls) and read it line by
line. All these lines will have the name of the files which needs to
be pened by me.
3) Then I concatenate this file name with the location of the file
(and put it in a variable say absolutefilename) resulting in the
absolute file name i.e. /absolute-path/filename
4) I then try to open this file by passing variable absolutefilename
to fopen function.
But file does not open. When i give the file name statically to th
fopen function at design-time file opens.
Please help on this.
Thanx a ton in advance.
Regards,
Saket