Prevent opening file stream with incorrect case of letters

Discussion in 'C++' started by Fraser Ross, Jan 15, 2004.

  1. Fraser Ross

    Fraser Ross Guest

    I want to prevent std::basic_ifstream from opening a file for reading when
    it is passed the file name with any wrong case of a letter. If that can't
    be done is there anything else that could be done before opening? The
    program is for Windows.

    Fraser.
     
    Fraser Ross, Jan 15, 2004
    #1
    1. Advertising

  2. On Thu, 15 Jan 2004 13:17:45 +0000, Fraser Ross wrote:

    > I want to prevent std::basic_ifstream from opening a file for reading when
    > it is passed the file name with any wrong case of a letter. If that can't
    > be done is there anything else that could be done before opening? The
    > program is for Windows.


    Easy. Just check the string containing the filename if it has the right
    case. I suspect you mean that it should match the case of the file as it
    appears in the directory though, and for that you'll have to look for
    answers in a Windows oriented group.

    HTH,
    M4
     
    Martijn Lievaart, Jan 15, 2004
    #2
    1. Advertising

  3. Fraser Ross

    Fraser Ross Guest

    FindFirstFile will probably do what I want.

    Fraser.
     
    Fraser Ross, Jan 15, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Lilja
    Replies:
    1
    Views:
    613
    Rapscallion
    Jun 4, 2005
  2. Merrigan
    Replies:
    4
    Views:
    610
    Chris
    Dec 14, 2007
  3. sofin
    Replies:
    1
    Views:
    395
    Victor Bazarov
    Nov 17, 2009
  4. timm
    Replies:
    1
    Views:
    168
  5. Venugopal
    Replies:
    11
    Views:
    1,682
    Tassilo v. Parseval
    Nov 5, 2003
Loading...

Share This Page