Re: How to verify the path of an open file.



On 26 Jul 2007, max.trinitron@xxxxxxx wrote:

Under UNIX/Linux you open a file with

fopen("anyDirectory/MyFile" "r")

and when it succeeds you know that the filename (and path) of the
file opened is exactly what you requested (otherwise you get
NULL). Under Windows the search for a file is case insensitive.
You may just have opened the file "AnyDirectory/myFile".

In such a case I want to write an error message (This should lead
to better portability between UNIX/Linux and Windows).

Is there a simple way to verify that the right file (case
sensitive filename compare) has been opened.

You're probably better off asking in an Microsoft specific newsgroup,
but you might want to look at the GetLongPathName() function. It
gives you the case-preserved full path name. But I'm not sure if
that qualifies as a simple way ;-)

Dave

--
D.a.v.i.d T.i.k.t.i.n
t.i.k.t.i.n [at] a.d.v.a.n.c.e.d.r.e.l.a.y [dot] c.o.m
.



Relevant Pages

  • Re: Transferring directory structure to Windows
    ... Transferring directory structure to Windows ... Filename collisions are a real threat but it should be ... whether FTP, tar, or whatever, you will only wind up ...
    (AIX-L)
  • RE: Bug in Windows 2000 Task Manager
    ... Since I don't know Japanese, could you help answer a small question so that I can confirm the issue and report it to our ... could you confirm if the filename can be displayed correctly in the explorer? ... Bug in Windows 2000 Task Manager ... Produced By Microsoft MimeOLE V6.00.2900.2670 ...
    (microsoft.public.win32.programmer.tools)
  • Re: Characters allowed in short filenames
    ... fatgen103.doc seems to have a slightly below average proportion of bugs, but Windows doesn't completely agree with it. ... > My partial understanding is that short filenames are stored using the> OEM ... > As far as I can tell, code page 437 doesn't contain a ß character. ... > page is 850 then we are halfway towards allowing a short filename to ...
    (microsoft.public.development.device.drivers)
  • gnu grep in windows
    ... windows, it should not be. ... while also fixing this filename case sensitivity ... Fix this first by giving grep a directory to recurse into. ...
    (comp.windows.x.i386unix)
  • Re: Reading Text Files
    ... those questions that has far more to do with Windows than it has ... If the string doesn't represent such a filename, ... Consider, for example, MVS, in which filenames consist of digits, ... but *only* in the context of a PDS. ...
    (comp.lang.c)