Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am using QFileDialog::getSaveFileName method to get a save dailog. It asks for new file name. When i give "abc:c" as a file name it pops up a message stating "The file name is invalid. But in case if i give file name as "abc?c" or "anc*c". It doesn't give any error. Though the dialog doesn't accept that input file name but it doesn't give any error.

Please let me know what can i do to get a error message in case of "abc?c" or "anc*c" as a file name.

Thanks in advance
Posted

1 solution

I would guess that is because the ? and * are used as wild-card indicators in filenames. You would need to test for them yourself.
 
Share this answer
 
Comments
sourabhmehta 28-Sep-12 4:43am    
Thanks for the reply.
I agree with your explanation, But how can i check for existence of ? or *. Since this QT widget itself takes care of other invalid characters. Moreover in case of ? or * characters the dialog doesn't return anything. Otherwise i would have checked for these characters in the returned string.

Do you have any idea how can i achieve this.
Richard MacCutchan 28-Sep-12 5:06am    
This is an issue with Windows, as I said above. I have just tried something similar using a simple Win32 program and the ? in the name just restricts the dialog to showing any names which match. The user must then select a specific name to get the dialog to proceed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900