ansi

Iterate through char array and print chars

梦想的初衷 提交于 2019-12-10 17:14:01
问题 I am trying to print each char in a variable. I can print the ANSI char number by changing to this printf("Value: %d\n", d[i]); but am failing to actually print the string character itself. What I am doing wrong here? #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) { int len = strlen(argv[1]); char *d = malloc (strlen(argv[1])+1); strcpy(d,argv[1]); int i; for(i=0;i<len;i++){ printf("Value: %s\n", (char)d[i]); } return 0; } 回答1: You should use %c

How do I determine size of ANSI terminal?

元气小坏坏 提交于 2019-12-10 13:26:12
问题 Standard input and output are connected to a terminal that implements ANSI escape sequences, but is of unknown dimensions. I need to know how big the terminal so to facilitate drawing a full-screen text UI on it. How can I get the size? The correct size is not loaded into environment variables. I cannot use TIOCGETS; the the call would return success but the values are not correct -- the kernel doesn't know the size either. There are lots and lots of answers searching stackoverflow, but they

Does Windows console supports ANSI?

五迷三道 提交于 2019-12-10 10:27:15
问题 Does the Windows console supporsts ANSI control characters? 回答1: It doesn't support many ANSI control characters by default (which is also mentioned in the wikipedia article http://en.wikipedia.org/wiki/ANSI_escape_code), but there are ways to make that possible. Look into the answers to this question: How to load ANSI escape codes or get coloured file listing in WinXP cmd shell? You might happen upon something useful. 回答2: I assume you're referring to ASCII control characters. The answer is

Behave test runner has no colored output on Jenkins

为君一笑 提交于 2019-12-08 19:14:39
问题 I have setup jenkins on Ubuntu server 14.04 on an EC2 instance. I have some selenium tests that I execute using behave as test runner. On Jenkins I have also installed the plugin AnsiColor hoping that I can get color output on the jenkins console, however I get color for everything else except for the Gherking syntax. Selenium errors, python debug, everything has color... except for the output of behave. Now the thing is if I run the tests on a Mac or on Ubuntu but not with the Jenkins user,

Unicode turns ANSI after FTP transfer

空扰寡人 提交于 2019-12-08 08:59:25
问题 I have a bunch of unicode (UTF-16LE) xml files that I want to transfer via an old OLD vb6 ftp component, but when I send them through there, they turn to ANSI on the ftp server side (win2k3 server). When I attempt to send it using the windows terminal ftp client, it works fine whether I use binary or ascii transfer mode. The file stays unicode. What could be possible causes of this? Edit: perhaps unrelated, but I notice sending files through an old email component also does this to unicode

How to declare a dynamic integer array in ANSI - C using malloc and put input integers into it?

℡╲_俬逩灬. 提交于 2019-12-08 05:45:41
问题 First I want the user to input what is the size of the desired array. So I am using: int size; scanf("&d",&size); Now I want to create an integer array using a pointer and the malloc function. This is what I did: int *p1 = (int*)malloc(sizeof(int)*size); According to my understanding, this is like using: int p1[size]; But how do I use it like an array? Question 1: Now I want the user to input as many integers as he wrote into this "array". But I can't use p[0] because it is not an array, it

Using strtol to validate integer input in ANSI C

橙三吉。 提交于 2019-12-07 17:56:48
问题 I am new to programming and to C in general and am currently studying it at university. This is for an assignment so I would like to avoid direct answers but are more after tips or hints/pushes in the right direction. I am trying to use strtol to validate my keyboard input, more specifically, test whether the input is numeric. I have looked over other questions on here and other sites and I have followed instructions given to other users but it hasn't helped me. From what I have read/

Convert ANSI characters to UTF-8 in Java

荒凉一梦 提交于 2019-12-07 15:39:39
问题 Is there a way to convert an ANSI string to UTF using Java. I have a custom serializer that uses readUTF & writeUTF methods of the DataInputStream class to deserialize and serialze string. If i receive a string encoded in ANSI and is too long, ~100000 chars long i get the error; Caused by: java.io.UTFDataFormatException: encoded string too long: 106958 bytes However in my Junit tests i'm able create a string with 120000 'a's and it works perfectly I have checked the following posts but still

How do command-line interpreters work?

浪子不回头ぞ 提交于 2019-12-07 11:55:23
问题 I have been under the impression that processes on the operating system have three standard streams: stdin, stdout, and stderr . I have also thought that text editors like vim work by taking input over stdin and sending ANSI escape characters over stdout . However, my view of how command-line interpreters isn't holding up in this one case: When I run the command C:\cygwin\bin\bash.exe , I am prompted with: Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All

Widestring to string conversion in Delphi 7

别说谁变了你拦得住时间么 提交于 2019-12-07 03:46:13
问题 my app is a non-unicode app written in Delphi 7. I'd like to convert unicode strings to ANSI with this function : function convertU(ws : widestring) : string; begin result := string(ws); end; I use also this code to set the right codepage to convert. initialization SetThreadLocale(GetSystemDefaultLCID); GetFormatSettings; It works great in the VCL main thread but not in a TThread, where I get some questions marks '?' as result of function convertU . Why not in a TThread ? 回答1: Calling