02-28-2014 02:48 AM
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
02-28-2014 03:34 AM
The source code of FileExists is in toolbox.c, so you could inspect and adapt it (in a copy...)
02-28-2014 03:53 AM
Oh ok thanks Wolfgang.. it doesnt seem possible though as it only looks for size of the file not characters.
Thanks anyway!
02-28-2014 03:59 AM
Actually I did not understand your original problem, but are you aware of the ANSI function tolower() ?
02-28-2014 04:11 AM
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
02-28-2014 04:36 AM
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)
02-28-2014 05:01 AM
Oh i dint know that. Ok yes that helps. thank you!
02-28-2014 05:10 AM
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);
02-28-2014 05:40 AM - edited 02-28-2014 05:40 AM
This is because NTFS is sort of special, in principle it is case sensitive but one cannot create files differeing only in case. Wikipedia
02-28-2014 06:17 AM - edited 02-28-2014 06:17 AM
Cannot create, cannot copy, cannot move, cannot rename... I wonder if having two files differing in case is practically possible!