CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002

    win32_find_data structure?

    I'm working with the win32_find_data structure and storing the returned structures in an array; I don't know if that is important to my question or not, may be irrelevant. If possible I'd like to trim the null chars off the cfilename member but I'm not having any luck.

    I have tried using RTrim as well as some string manipulation by using Instr to find the first null and shorten the string. The result of either of these methods shows that the string being returned is properly trimmed but it doesn't stick in the win32_find_data structure, the string there remains 250 chars long (that is the length given in the structure declaration). Is it impossible to change this since the structure is declared this way? Would it also be impossible to have an array of this structure where each element of the array can (potentially) have a cfilename member of varying length? I did check that I'm able to alter the string, which I can, but it remains padded with nulls regardless of what I do.

    I was just hoping to trim the strings in the array so I don't have to trim them every time I want to access a file name. Any suggestions are appreciated.

  2. #2
    Join Date
    Apr 2009

    Re: win32_find_data structure?

    Create a type like the structure you want with regular strings and as soon as the UDT is Returned, do you trimming from one UDT to the other...

    Good Luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.