This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

strange fopen


Hi,

I have problem with fopen() files with char '%' in name (cygwin-b20 under Win98).
Here is example:

/*---------------------------------------------------------*/
#include <windows.h>
#include <stdio.h>
#include <errno.h>

int main(void)
{
 FILE *fp;
 WIN32_FIND_DATA l1;
 HANDLE hDir;

hDir=FindFirstFile("*",&l1);
do 
  { 
    if(strcmp(l1.cFileName,".")==0) continue;
    if(strcmp(l1.cFileName,"..")==0) continue;
    printf("name:%s ",l1.cFileName);
    if((fp=fopen(l1.cFileName,"rb"))!=NULL) { printf("ok\n"); fclose(fp); }
     else { printf("err:%s\n",strerror(errno)); };
  }
 while(FindNextFile(hDir,&l1)==TRUE);
}
/*---------------------------------------------------------*/

and results:

$ gcc d.c 
$ ls -la
a----w       301765  03-Dec-99   2:59:44  a.exe
a----w          500  03-Dec-99   2:57:02  d.c
a----w            7  03-Dec-99   2:31:38  test%
3 files.
$ a.exe
name:test% err:No such file or directory
name:d.c ok
name:a.exe ok

Strange is that if I'm using -mno-cygwin it works fine:

$ gcc d.c -mno-cygwin
$ ls -la
a----w       172168  03-Dec-99   3:03:00  a.exe
a----w          500  03-Dec-99   2:57:02  d.c
a----w            7  03-Dec-99   2:31:38  test%
3 files.
$ a.exe
name:a.exe ok
name:test% ok
name:d.c ok

Can anybody tell me where is problem ?


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]