Critter Guy

There is a C#, a C++, a visual basic...ugh.

Ok. So...those of you familiar with C, what's wrong with this:

LPCTSTR CurDir = "C:\Documents and Settings\test folder\*";

The * is there because I want the function FindFirstFile to find the first file in that folder.

Futhermore, is it possible for me to use the * to find any first file if...say...I was passed "C:\Docum..." from a funciton such that CurDir = "C:\Documents and Settings\test folder" (assuming the user input that path).



Re: Visual C++ General Question about programming in C for windows...

Jessy D. Exum

I see two problems. First, you need to use escape codes for every '\' you have. Second, I had a couple errors until I made the string UNICODE (Visual Studios makes your application UNICODE by default). The fix I have is this:
LPCTSTR CurDir = L"C:\\Documents and Settings\\test folder\\*";

If you have any questions about UNICODE or Escape characters, feel free to ask or do a Google search. Also, this helped me out with all of the annoying 'string' types in C/C++: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=136598&SiteID=1