NO

Author Topic: _findfirst, _findnext  (Read 3527 times)

Offline daniel_bingamon

  • Member
  • *
  • Posts: 22
_findfirst, _findnext
« on: March 31, 2020, 03:33:31 PM »
I've heard that Windows 10 _findfirst, _findnext and variants of these for plain ASCII data is broken in latest UCRT.
In Windows 7, with an older PellesC release this works but it doesn't in Windows 10 32 or 64-bit.
Is there a way to make this work in all versions?
I also tried FindFirstFile, no luck there either.

void sScrapeDataFiles(void)
{
struct _finddata_t dirstruct;
intptr_t  handle;   // This was originally long, it worked as a long.

//..........omitted  portions

  handle = _findfirst("*.dat", &dirstruct);
  if(handle != -1)
  {
    do
    {
      mk_ucase(dirstruct.name);
      sprintf(buf, "Opening and Scanning: %s", dirstruct.name);
      SetDlgItemText(wMain, IDC_STATUS, buf);

MessageBox(wMain, dirstruct.name, "Found", MB_OK);  // Added for troubleshooting
      // scanning subroutine omitted for readability.
    }
    while(_findnext(handle, &dirstruct) == 0);
 
    _findclose(handle);
  }
}

Offline John Z

  • Member
  • *
  • Posts: 860
Re: _findfirst, _findnext
« Reply #1 on: March 31, 2020, 04:47:33 PM »
Interesting - I can say that for windows 10, Pelles C version 9 both _wfindfirst, and _wfindnext work perfectly.

Unfortunately my Win10 development platform is down right now due to a bad MS OS auto "update" so I can't test your actual case _findfirst and _findnext on Windows 10.

You mention "you heard" and tested can you report what is the error or what is not working?

Offline daniel_bingamon

  • Member
  • *
  • Posts: 22
Re: _findfirst, _findnext
« Reply #2 on: March 31, 2020, 05:42:57 PM »
I could not get the code running on Pelles 9.0, I reverted back to 8.00.60 and it is running fine in multiple environments.

The broken comment is based on this URL: https://developercommunity.visualstudio.com/content/problem/292977/-findfirst-findnext-non-wide-versions-are-broken-i.html

I'm going to re-update to 9 and see what happens.   Maybe a library was corrupted on the hard drive.

Offline daniel_bingamon

  • Member
  • *
  • Posts: 22
Re: _findfirst, _findnext
« Reply #3 on: March 31, 2020, 05:46:39 PM »
Confirmed, now that 9.00.9 is reloaded it is running fine.

Offline John Z

  • Member
  • *
  • Posts: 860
Re: _findfirst, _findnext
« Reply #4 on: April 01, 2020, 11:10:03 AM »
Good news, thanks for updating, could be a help to others.