Need help Urgent
-
Hi Iam developing a Dialog based application. In that application user has to add some files to perfrom the next operation, so i need to validate the file path,file name,for further operation. how can i check that user has entered the correct path,file name
-
Hi Iam developing a Dialog based application. In that application user has to add some files to perfrom the next operation, so i need to validate the file path,file name,for further operation. how can i check that user has entered the correct path,file name
reddy harish wrote:
how can i check that user has entered the correct path,file name
It depends of what you mean by that exactly. If you simply want to check if the file exist, you can simply try to open is (with fopen for example) and if the function succeed, then the file exists. Supply the absolute path so that you can check the path and the file name.
Cédric Moonen Software developer
Charting control -
Hi Iam developing a Dialog based application. In that application user has to add some files to perfrom the next operation, so i need to validate the file path,file name,for further operation. how can i check that user has entered the correct path,file name
Easiest way - get them to select files with the file dialog and set the style so the filename entered must exist.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Hi Iam developing a Dialog based application. In that application user has to add some files to perfrom the next operation, so i need to validate the file path,file name,for further operation. how can i check that user has entered the correct path,file name
See Cedric Moonen answer.... and see
SetCurrentDirectory(...)
and see return value.Is your purpose_**
**_
WhiteSky
-
reddy harish wrote:
how can i check that user has entered the correct path,file name
It depends of what you mean by that exactly. If you simply want to check if the file exist, you can simply try to open is (with fopen for example) and if the function succeed, then the file exists. Supply the absolute path so that you can check the path and the file name.
Cédric Moonen Software developer
Charting controlThnks for ur reply. but If the user is entering the wrong file path or file name and he is trying to perform the next operation,how can we prevent him from that.so that we have to write the code to give him messeage or to stop him. Ex:when we are entering the wrong file name or path in the "RUN" command,it shows us a warning or message saying that is not exist. Like that can we perform the operation
-
Thnks for ur reply. but If the user is entering the wrong file path or file name and he is trying to perform the next operation,how can we prevent him from that.so that we have to write the code to give him messeage or to stop him. Ex:when we are entering the wrong file name or path in the "RUN" command,it shows us a warning or message saying that is not exist. Like that can we perform the operation
Uuuhh :confused: ?? Did you read my post :~ ? If you try to open a file that doesn't exist in read mode, fopen will return an error. So in that case you know that the file is wrong and you can display a message and not continue to the next step. Anyway, the solution of Christian is better (and you provide also an elegant way to choose the file for the user).
Cédric Moonen Software developer
Charting control -
Hi Iam developing a Dialog based application. In that application user has to add some files to perfrom the next operation, so i need to validate the file path,file name,for further operation. how can i check that user has entered the correct path,file name
-
Hi Iam developing a Dialog based application. In that application user has to add some files to perfrom the next operation, so i need to validate the file path,file name,for further operation. how can i check that user has entered the correct path,file name
Christian's solution will work for the most part. I'd just add that after you select a file, use CFile::GetStatus to determine if it exists or not. The method will return TRUE if it succeeds, and FALSE if the file/directory doesn't exist.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac