Paul,
INSTRING has the same issue as STRING (outputting strings from C to Fortran with STRING or OUTSTRING works fine - a null-terminated C-string gets converted as expected). It still seems to me that there is either a small bugette here, or more likely, there is a specific reason why 'empty' strings are passed as a single space rather than an empty C string. The ftn95 help is pretty detailed in its description of STRING/INSTRING saying that the compiler will generate the appropriate null-terminated string for passing to the DLL - since a single string of spaces in Fortran is considered an 'empty' string this implies that an empty C-string should be passed (if your fortran string contains non-space text, any trailing spaces disappear in the C - so a Fortran 'fred ' becomes a C 'fred' (so I would expect), but a fortran ' ' becomes a C ' '). Presumably the issue is the same when using the Win32 API - any attempt to pass an empty string in directly would result in a single ' '.
It's not difficult to get around, but it would be useful to have some clarification because if there are other situations where we may get trailing spaces then its probably not worth using STRING/INSTRING - I might as well just pass the Fortran string in as a ref and have a C 'len_trim' function and avoid any extra buffering or conversion. If the only time it happens is with a blank string, then checking for the specific case of a single ' ' isn't a problem.
Any further clarification or info would be greatly appreciated,
Alan