March 19th, 2010, 03:06 AM
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.
March 19th, 2010, 11:16 AM
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...
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.