[Interest] using windows FindFirstFile
Graham Labdon
Graham.Labdon at avalonsciences.com
Thu Feb 16 08:45:58 CET 2012
THnaks!!
-----Original Message-----
From: interest-bounces+graham.labdon=avalonsciences.com at qt-project.org [mailto:interest-bounces+graham.labdon=avalonsciences.com at qt-project.org] On Behalf Of David Ching
Sent: 15 February 2012 18:01
To: interest at qt-project.org
Subject: Re: [Interest] using windows FindFirstFile
> Date: Wed, 15 Feb 2012 11:58:32 +0000
> From: Graham Labdon <Graham.Labdon at avalonsciences.com>
> Subject: [Interest] using windows FindFirstFile
>
> In the code below the call to FindFirstFile always fails with the
> error
'ERROR_INVALID_NAME'
> The file that I set in searchPath does exist.
> Does anyone know the correct way to do this?
> ...
> WIN32_FIND_DATA FindFileData;
> HANDLE hFind;
> QString searchPath = "C:/jobs/daryll/Rcd/f_000001.rcd";
> WCHAR p[100];
> int x = searchPath.toWCharArray(p);
> hFind = FindFirstFile(p, &FindFileData);
First, you should declare
WCHAR p[MAX_PATH]; // MAX_PATH is max length of a Windows path gotten from <drive>:<path> syntax
The real problem is searchPath should be e.g.
QString searchPath = "C:/jobs/daryll/Rcd/*"; // include wildcard '*'
-- David
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list