ansi

VS2010 C and C++ - enforce ANSI compliance for Linux/gcc compatibility?

元气小坏坏 提交于 2019-11-28 04:13:44
问题 I'm taking a class in which I'm required to write some C++ apps for Linux. I really, really dislike the dev tools available under Linux, but I love VS2010. Is there any sort of compiler switch which will enforce ANSI or gcc compatibility in VC++? Or can I swap the compiler out for gcc and still use the VS environment? 回答1: You can disable Microsoft extensions to the ANSI C and ANSI C++ standards by specifying the /Za flag, which will make the compiler emit errors if you use non-standard C and

WinAPI Unicode and ANSI functions

不羁的心 提交于 2019-11-28 01:34:21
Most of WinAPI calls have Unicode and ANSI function call For examble: function MessageBoxA(hWnd: HWND; lpText, lpCaption: LPCSTR; uType: UINT): Integer; stdcall;external user32; function MessageBoxW(hWnd: HWND; lpText, lpCaption: LPCWSTR; uType: UINT): Integer; stdcall; external user32; When should i use the ANSI function rather than calling the Unicode function ? The simplest rule to follow is this. Only use the ANSI variants on systems that do not have the Unicode variant. That is on Windows 95, 98 and ME which are the versions of Windows that implement Win32 and do not support Unicode.

How to convert ansi text to utf8

扶醉桌前 提交于 2019-11-28 00:15:15
问题 How to convert ansi text to utf8 in Go? I am trying to convert ansi string to utf8 string. 回答1: Go only has UTF-8 strings. You can convert something to a UTF8 string using the conversion described here from a byte[]: http://golang.org/doc/go_spec.html#Conversions 回答2: Here is newer method. package main import ( "bytes" "fmt" "io/ioutil" "golang.org/x/text/encoding/traditionalchinese" "golang.org/x/text/transform" ) func Decode(s []byte) ([]byte, error) { I := bytes.NewReader(s) O := transform

Convert a file encoding using R? (ANSI to UTF-8)

安稳与你 提交于 2019-11-28 00:03:22
问题 I wish to convert an HTML file encoded in ANSI to UTF-8, using R. Is there a tool, or a combination of tools, that can make this work? Thanks. Edit : o.k, I've narrowed my problem to another one. It is re-posted here: Using "cat" to write non-English characters into a .html file (in R) 回答1: you can use iconv: writeLines(iconv(readLines("tmp.html"), from = "ANSI_X3.4-1986", to = "UTF8"), "tmp2.html") tmp2.html should be utf-8. Edit by Henrik in June 2015: A working solution for Windows

Can an ANSI C-compliant implementation include additional functions in its standard library?

霸气de小男生 提交于 2019-11-27 23:07:21
Is an ANSI C-compliant implementation allowed to include additional types and functions in its standard library, beyond those enumerated by the standard? (An ideal answer would reference the relevant part of the ANSI standard.) I ask particularly because Mac OS 10.7 declares the getline function in stdio.h, even when compiling with gcc or clang using the -ansi flag. This breaks several older programs that define their own getline function. Is this a fault of Mac OS 10.7? (The man page for getline on Mac OS 10.7 says that getline conforms to the POSIX.1 standard, which came in 2008.) Edit: To

How to read an ANSI encoded file containing special characters

梦想与她 提交于 2019-11-27 20:15:12
问题 I'm writing a TFS Checkin policy, which checks if our source files containing our file header. My problem is, that our file header contains a special character "©" and unfortunately some of our source files are encoded in ANSI. So if I read these files in the policy, the string looks like this "Copyright � 2009". string content = File.ReadAllText(pendingChange.LocalItem); I tired to change the encoding of the string, but it does not help. So how can I read these files, that I get the correct

Adding ANSI color escape sequences to a bash prompt results in bad cursor position when recalling/editing commands

孤人 提交于 2019-11-27 17:43:51
问题 If I set my command prompt like: export PS1='\033[0;33m[\u@\h \w]\$ \033[00m' The color of the prompt will be yellow and everything after the '$' character will be the default terminal color. This is what I expect. However, If I recall a command line and attempt to edit it, moving the cursor -- either UpArrow/Ctrl-A (set -o emacs) or ESC K (set -o vi) if the command line I'm trying to edit is long enough, the cursor is not positioned at the beginning of the command. Typing either Ctrl-A (set

Where can I find the C89/C90 standards in PDF format? [closed]

元气小坏坏 提交于 2019-11-27 16:45:57
I'm looking for a free copy version of the C89/C90 standard , but I can't find it anywhere! Why is so hard to find it? C99 and C11 standards are very easy to get a copy of on Internet. Even in Stack Overflow question Where do I find the current C or C++ standard documents? and in The C Standard, Obtaining the Standard don't contain what I'm looking for. Web searches didn't helped either, nor Open Standards . R.. You can find nice HTML versions of C89, C99, and C11, as well as some of the official draft PDF files they're generated from, here: http://port70.net/~nsz/c/ Some other useful direct

adding text decorations to console output

流过昼夜 提交于 2019-11-27 15:07:19
问题 I have a c# .net 3.5 application that writes text to the console using a StreamWriter. Is there a way I can add text decorations like underline and strikethrough to the text that is printed to the console? Possibly using ANSI escape sequences? TextWriter writer = new StreamWriter(Console.OpenStandardOutput()); writer.WriteLine("some underlined text"); Thanks, PaulH 回答1: The Windows console does not support ANSI escape sequences. To my knowledge, the only way to change the attributes of an

How can I get TStringList to sort differently in Delphi

青春壹個敷衍的年華 提交于 2019-11-27 13:09:37
问题 I have a simple TStringList. I do a TStringList.Sort on it. Then I notice that the underscore "_" sorts before the capital letter "A". This was in contrast to a third party package that was sorting the same text and sorted _ after A. According to the ANSI character set, A-Z are characters 65 - 90 and _ is 95. So it looks like the 3rd party package is using that order and TStringList.Sort isn't. I drilled down into guts of TStringList.Sort and it is sorting using AnsiCompareStr (Case Sensitive