Thread: Unicode C runtime lib in VS2008

  1. #16
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Opariti View Post
    Mats, I like this : . I'll dig into since this would be great! For the rest (msvcrt.dll/strlen is not unicode btw ...) I may not have been clear in my initial post. But, amazing, while the others came to the issue, you pop-up a very interesting opening! Thanks.
    Sure. strlen is not unicode, nor is strcpy, strcat, etc. You need to use wcslen, and wcscpy, wcwcat, etc, etc.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #17
    In my head happyclown's Avatar
    Join Date
    Dec 2008
    Location
    In my head
    Posts
    391
    Quote Originally Posted by matsp View Post

    Define _CRT_SECURE_NO_DEPRECATE to avoid those "use fscanf_s" instead messages.
    Sorry to bring up this thread again.

    Here's a warning I got:
    Code:
    warning C4996: 'fopen': This function or variable
    may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. 
    See online help for details.
    I tried:
    Code:
    #define _CRT_SECURE_NO_WARNINGS
    but that didn't work.

    I used the online(vc++ 2008) help, and it says to "simply define _CRT_SECURE_NO_WARNINGS", with no instructions of how to go about it.

    I did some research on the internet, and it appears I need to edit property sheets, but the VC++ 2008 Express instructions for property sheets don't match what I see on the screen(and don't match the options that are available). Perhaps it is for another version of VC++.
    Last edited by happyclown; 01-24-2009 at 07:25 PM. Reason: edited compiler warning
    OS: Linux Mint 13(Maya) LTS 64 bit.

  3. #18
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,334
    #define has to happen before #include.

  4. #19
    In my head happyclown's Avatar
    Join Date
    Dec 2008
    Location
    In my head
    Posts
    391
    Quote Originally Posted by tabstop View Post
    #define has to happen before #include.
    Yep, that did the trick. Thanks.
    OS: Linux Mint 13(Maya) LTS 64 bit.

  5. #20
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,653
    You may also want to consider using the more secure functions, as well.
    True, not as portable, but they are safer. Well, that can be debatable, but at least they help find bugs.
    Mostly, simple wrappers can be built for these functions for compilers that do not support these.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. <string> to LPCSTR? Also, character encoding: UNICODE vs ?
    By Kurisu33 in forum C++ Programming
    Replies: 7
    Last Post: 10-09-2006, 12:48 AM
  2. Should I go to unicode?
    By nickname_changed in forum C++ Programming
    Replies: 10
    Last Post: 10-13-2003, 11:37 AM
  3. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 06:51 PM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM