LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

FileExists() to take into account letters in Caps?

Hi,

 

I am using this function FileExists(&file_name,0) and would like to know if there is a way to make it take into account capital letters as well? For exaple file names file1 and File1 should not return FileExists as positive. 

 

Thank you!!

 

Sinnas

0 Kudos
Message 1 of 10
(4,527 Views)

The source code of FileExists is in toolbox.c, so you could inspect and adapt it (in a copy...)

0 Kudos
Message 2 of 10
(4,523 Views)

Oh ok thanks Wolfgang.. it doesnt seem possible though as it only looks for size of the file not characters. 

 

Thanks anyway!

 

 

0 Kudos
Message 3 of 10
(4,519 Views)

Actually I did not understand your original problem, but are you aware of the ANSI function tolower() ?

0 Kudos
Message 4 of 10
(4,515 Views)

Yes i am aware but what im am looking for is for my application to distinguish between C:\Appli\file1 and C:\Appli\File1;

The application will look to see if file1 exists and should not return positive value if File1 exists. 

 

*using ghost drives 

0 Kudos
Message 5 of 10
(4,513 Views)

I would assume that it depends on the file system, FAT32 isn't case sensitive so there is nothing fopen() can do... (as far as I know)

0 Kudos
Message 6 of 10
(4,506 Views)

Oh i dint know that. Ok yes that helps. thank you! 

0 Kudos
Message 7 of 10
(4,501 Views)

Based on this knowledge base article from Microsoft, NTFS volumes should permit having files that differs only in case, but a serious limitation is that win32 applications cannot correctly access them: MS mentions Notepad as an example, I suppose this is valid for CVI programs too if developed in 32-bit mode.

 

A very basic attempt with this code resulted in a single file with lowercase name as the first one created but with the second text in it:

 

#include <formatio.h>
static int		fH;

fH = OpenFile ("c:\\temp\\test1.txt", VAL_WRITE_ONLY, VAL_TRUNCATE, VAL_ASCII);
WriteFile (fH, "One line of text\n", 18);
CloseFile (fH);

fH = OpenFile ("c:\\temp\\Test1.TXT", VAL_WRITE_ONLY, VAL_TRUNCATE, VAL_ASCII);
WriteFile (fH, "Another line of text\n", 22);
CloseFile (fH);

 

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 8 of 10
(4,500 Views)

This is because NTFS is sort of special, in principle it is case sensitive but one cannot create files differeing only in case. Wikipedia

0 Kudos
Message 9 of 10
(4,495 Views)

Cannot create, cannot copy, cannot move, cannot rename... I wonder if having two files differing in case is practically possible!



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 10 of 10
(4,487 Views)