Opening file with Euro symbol in pathname.

This is a discussion on Opening file with Euro symbol in pathname. within the C Programming forums, part of the General Programming Boards category; I am using DJGPP C compiler. Using fopen to try and open file. It did not work. I looked at ...

  1. #1
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794

    Opening file with Euro symbol in pathname.

    I am using DJGPP C compiler.

    Using fopen to try and open file.
    It did not work.
    I looked at the string in hex and noticed the symbol was code 63 which is displayed as ? sign.
    So I changed it to 128 (I looked up the code).

    It still says it won't open the file.
    I print a debug message of the file it can't open, that displays the euro sign correctly and if I cut and paste the string into the windows 'run' box it opens the file correctly.

    Any ideas on how to fix this?

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    595
    Maybe make a copy of the file & don't use extended-ascii characters in the filename?

  3. #3
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by R.Stiltskin View Post
    Maybe make a copy of the file & don't use extended-ascii characters in the filename?

    I don't actually create the file, it is created by an on-line process so that is a bit of a problem.
    I could wait until the file is closed but that is not ideal.
    I could copy it but that is messy.

    I really want a programming solution and to know why it does work.

  4. #4
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    OK I tried using CodeBlocks and some of the compilers there compiled and ran it OK.

    It still would not work in the DJGPP compiler though.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Then you have your answer.... you need a better compiler.

    Also, try setting the char array that holds the filename to unsigned char as the Euro symbol is probably an extended ascii character...

    Or use unicode and wchar_t for your filename string and using the unicode version of your file open command.

  6. #6
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by CommonTater View Post
    Then you have your answer.... you need a better compiler.

    Also, try setting the char array that holds the filename to unsigned char as the Euro symbol is probably an extended ascii character...

    Or use unicode and wchar_t for your filename string and using the unicode version of your file open command.
    Well it had been fine up untill know.

    Using a new one force me to do silly things like but void before functions and other pesky stuff like that which the old compiler was quite happy with.

    This Codeblock has about 10 different compilers in - I have no idea which is the best.
    Any recommendations?

    I might as well star using the code blocks environment more now, it makes some
    things easier and it has a debugger (not tried it yet).

    I like how it hides commented out lines, I can still use my old editor in tandem with it too.

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Code::Blocks is just an IDE... you get to choose your compiler at project creation time... and I believe you can change it later as well... And no, I wouldn't want to hide anything while programming...

    And the business of putting void before functions is a good one... by default C functions return an integer value. Programming is the one place where laziness and bad form will always come back to bite you.

    The best compiler depends where you are and what you're doing...
    For plain C on Windows... use the MSVC++ compiler in C mode.
    For plain C on Unix/Linux... you probably want the GCC compiler.

  8. #8
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    611
    Quote Originally Posted by CommonTater View Post
    For plain C on Windows... use the MSVC++ compiler in C mode.
    I'm shocked, has Pelle stopped the kickbacks coming or something :-)

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by adeyblue View Post
    I'm shocked, has Pelle stopped the kickbacks coming or something :-)
    Very funny.

    He's using Code:Blocks and asked which compiler... apparently meaning from the ones installed in/with Code::Blocks.

    And yes... if he had specified Windows and not mentioned Code:Blocks I would definately have recommended Pelles C... smorgasbordet - Pelles C

    Happy now?

  10. #10
    msh
    msh is offline
    Novice
    Join Date
    Jul 2009
    Posts
    568
    Quote Originally Posted by CommonTater View Post
    The best compiler depends where you are and what you're doing...
    For plain C on Windows... use the MSVC++ compiler in C mode.
    For plain C on Unix/Linux... you probably want the GCC compiler.
    Note about MSVC. To the best of my knowledge it still does not implement C99 standard fully, therefore, you will be missing out on some neat features that it makes available to you.

    I would recommend MinGW, which is a port of GCC for Windows.
    Disclaimer: This post shows my ignorance at the time of its making. I claim ownership of but not responsibility for all errors in it. Reference at your own peril.

  11. #11
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Do they offer support for a graphical interface s you seem what I mean?
    IE windows type dialogue boxes, graphical display etc, cursor detection etc...???

  12. #12
    msh
    msh is offline
    Novice
    Join Date
    Jul 2009
    Posts
    568
    Nothing of what you listed is actually offered by the compiler.
    Disclaimer: This post shows my ignorance at the time of its making. I claim ownership of but not responsibility for all errors in it. Reference at your own peril.

  13. #13
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,158
    63 isn't just "displayed as" the '?' character, it IS the '?' character.

    The '?' character is not permitted in Windows filenames. Thus it is no mystery why you are failing to open the file.

    How did a file get created with a forbidden character in its filename? I'd suspect a virus, filesystem corruption, or something like that.

    (I really don't understand why you guys are talking about compilers, this has nothing to do with that)
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  14. #14
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by msh View Post
    Nothing of what you listed is actually offered by the compiler.

    So how do you get them?

  15. #15
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by brewbuck View Post
    63 isn't just "displayed as" the '?' character, it IS the '?' character.

    The '?' character is not permitted in Windows filenames. Thus it is no mystery why you are failing to open the file.

    How did a file get created with a forbidden character in its filename? I'd suspect a virus, filesystem corruption, or something like that.

    (I really don't understand why you guys are talking about compilers, this has nothing to do with that)

    It is not a virus.

    I created the files with a "dir >somefile.txt"

    The ? is in the somefile.txt so it seems MSDOS is the problem or part of the problem.

    I the Euro was not invented when MSDOS was around.
    I think the DJGPP compiler must use the same DOS commands to open the file.

    It's not a forbidden character, ie is the sign.

    That is in the extended ascii character set.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 04:02 AM
  2. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  4. inet_aton()... Noob needs help with sockets :|
    By Maz in forum C++ Programming
    Replies: 3
    Last Post: 11-22-2005, 03:33 PM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21