win2k内核是unicode, w98内核不是unicode. 你的文本文件是unicode编码?

解决方案 »

  1.   

    应该不是,因为我的文本文件保存以后用w98的notepad打开一切正常,所以觉得应该是我的程序的问题
      

  2.   

    用VC(二进制方式)打开你的的TXT文件,看看头二个字节是不是 "FF FE"?
    (UNICODE编码标记)
      

  3.   

    不是,我用UltraEdit察看了,就是单纯的ASCII文本文件。我又用别的计算机(Win98)编译了那程序,现在一切正常,但是这台用win2k编译的还是不行......大家给看看到底什么道理?
      

  4.   

    你用win2k编译出的程序是不是unicode版本呀?
    比如程序中的字串使用了_T("版本")定义格式?
      

  5.   

    有一些,比如下面的代码
    m_GR0 = _T("");
    m_GR1 = _T("");
    m_GR2 = _T("");
    m_GR3 = _T("");
    m_GR4 = _T("");
    m_PC = _T("");
    m_SP = _T("");
    m_FR = _T("");
    m_BINARY = _T("");
    m_COMBO = _T("");
    什么意思呢?刚用VC问题就是多
      

  6.   

    简单的说你的程序中使用了条件编译宏,例如_T("版本"),可以根据系统是否预定义了
    #define _UNICODE, 即是否支持UNICODE来选择合适的版本进行编译。
    在内核是unicode的操作系统中,_T("版本")按照unicode字串 wchar []="版本"进行了编译
    在内核不是unicode的操作系统中,_T("版本")按照字普通串  char []="版本"进行了编译所以在w2k下编译出的程序是UNICODE版本,在win98下无法正确显示
      

  7.   

    我检查了程序,没有发现#define _UNICODE宏定义阿
      

  8.   

    _UNICODE宏定义也可以在project setting中设置呀
    1)选择菜单"project->settings..."
    2)在project settings dialog中选择C/C++ tab.
    3)察看 "Preprocessor definitions:"中有没有定义 _UNICODE
      

  9.   

    我更加苦恼了!我就用Appwizard开始的那project,也没有做什么设置,也没有修改什么,怎么会这样?这怪事还不少,我用那源程序到我的一台98上编译,然后运行,一切正常,到我别的98的机器运行,又乱码!我要发疯了!!!
      

  10.   

    不要发疯...
    一切都会水落石出的. 你先看看这篇文章(from MSDN,title: "Using Generic-Text Mappings"),如果不幸还是不能解决你的问题, 你可以将工程源代码mail给我,如果你愿意...
    Using Generic-Text Mappings
    Microsoft Specific —>To simplify code development for various international ets, the Microsoft run-time library provides Microsoft-specific “generic-text” mappings for many data types, routines, and other objects. These mappings are defined in TCHAR.H. You can use these name mappings to write generic code that can be compiled for any of the three kinds of character sets: ASCII (SBCS), MBCS, or Unicode, depending on a manifest constant you define using a #define statement. Generic-text mappings are Microsoft extensions that are not ANSI compatible.Preprocessor Directives for Generic-Text Mappings#define           Compiled Version         Example  
    _UNICODE          Unicode (wide-character) _tcsrev maps to _wcsrev 
    _MBCS             Multibyte-character      _tcsrev maps to _mbsrev 
    None 
    (the default: neither _UNICODE nor _MBCS defined) SBCS (ASCII) _tcsrev maps to strrev 
    For example, the generic-text function _tcsrev, defined in TCHAR.H, maps to mbsrev if MBCS has been defined in your program, or to _wcsrev if _UNICODE has been defined. Otherwise _tcsrev maps to strrev. The generic-text data type _TCHAR, also defined in TCHAR.H, maps to type char if _MBCS is defined, to type wchar_t if _UNICODE is defined, and to type char if neither constant is defined. Other data type mappings are provided in TCHAR.H for programming convenience, but _TCHAR is the type that is most useful. Generic-Text Data Type MappingsGeneric-Text Data Type Name SBCS (_UNICODE, _MBCS Not Defined) 
    _MBCS Defined 
    _UNICODE Defined 
    _TCHAR char char wchar_t 
    _TINT int int wint_t 
    _TSCHAR signed char signed char wchar_t 
    _TUCHAR unsigned char unsigned char wchar_t 
    _TXCHAR char unsigned char wchar_t 
    _T or _TEXT No effect (removed by preprocessor) No effect (removed by preprocessor) L (converts following character or string to its Unicode counterpart) 
    For a complete list of generic-text mappings of routines, variables, and other objects, see Appendix B, Generic-Text Mappings.The following code fragments illustrate the use of _TCHAR and _tcsrev for mapping to the MBCS, Unicode, and SBCS models._TCHAR *RetVal, *szString;
    RetVal = _tcsrev(szString);If MBCS has been defined, the preprocessor maps the preceding fragment to the following code:char *RetVal, *szString;
    RetVal = _mbsrev(szString);If _UNICODE has been defined, the preprocessor maps the same fragment to the following code:wchar_t *RetVal, *szString;
    RetVal = _wcsrev(szString);If neither _MBCS nor _UNICODE has been defined, the preprocessor maps the fragment to single-byte ASCII code, as follows:char *RetVal, *szString;
    RetVal = strrev(szString);Thus you can write, maintain, and compile a single source code file to run with routines that are specific to any of the three kinds of character sets. See Also   Generic-text mappings, Data type mappings, Constants and global variable mappings, Routine mappings, A sample generic-text propgramEND Microsoft Specific
      

  11.   

    谢谢了,我没有定义_UNICODE,应该没有上文中所说的转换吧,这也正是我苦恼的地方。