ansi

VIM Unix commands printed in color

爷,独闯天下 提交于 2019-12-30 18:26:23
问题 I'm using MacVim and I would like to have ! commands printed in color. For example: In bash, the following echo statement prints Hello World in green (as expected): $ echo -e "\033[32m Hello World" Hello World However, in VIM the output is not color, and the escape codes are printed: :!echo -e "\033[32m Hello World" [32m Hello World How can one have VIM (and MacVim build 57 in particular) print the output of ! commands and honour ANSI color escapes. 回答1: You can't. But you can suspend the

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

自闭症网瘾萝莉.ら 提交于 2019-12-28 04:39:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . 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

Another “Why is my Uva 3n+1 solution not being accepted?” question

给你一囗甜甜゛ 提交于 2019-12-25 06:25:45
问题 Why is my solution failing? http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=36 I wrote this under the assumption that stdin was the source of the data. I fully expect that it is a problem with my code, but I am lost as to why I get 'Wrong Answer' as the result. (Compiler Choice was ANSI C) EDIT: modified to allow parameter 1 > param 2 (but now I get "presentation error" whatever that is) #include <stdio.h> #include <stdlib.h> int main

Sorting a 2D array with qsort

时光怂恿深爱的人放手 提交于 2019-12-24 14:28:25
问题 I'm trying to sort 2d array. First i sort it by column, then by rows. Column by column is working but row by row not. What's wrong in this code? int scmpr (const void *a, const void *b){ return strcmp((const char*)a, (const char*)b); } int main(void){ int i,j; char **tab; tab=(char**)malloc(sizeof(char*)* 10); for(i=0; i<10; i++){ tab[i]=(char*)malloc(sizeof(char)*15); } for(i=0; i<10; i++){ for(j=0; j<15; j++){ tab[i][j]=rand()%20+'b'; printf("%c ", tab[i][j]); } puts(""); } for (i = 0; i<10

How to avoid Passing config variable in every function which uses this configurtation

浪子不回头ぞ 提交于 2019-12-24 11:49:18
问题 How can I avoid passing a "config" variable in every function which uses this configuration. what is the most accurate way to make such a behavior. This is my code: main.c /* Complex Numbers Linking to proper variable */ typedef struct tagConfigNames { char name; complex *cnum; } config_names; /* Set command to function */ struct { char *name; void (*func)(config_names[]); } cmd[] = {{"read_comp", read_comp}, {"print_comp", print_comp}, {"halt", halt},{"not_valid", NULL} }; int main() {

Get maximum and minimum from numbers

こ雲淡風輕ζ 提交于 2019-12-24 11:04:17
问题 I need to print maximum and minimum number from numbers. Problem is that when i set mn and mx to 0 it just wont work because when user write numbers 1 2 3 4 5 minimum is 0 and not 1 and thats the problem. My code: #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { int x, mx = 0, mn = 0; int i = 1, n; scanf("%d", &n); for (i = 1; i <= n; i++) { printf("Your number %d:", i); scanf("%d", &x); if (x > mx) { mx = x; }; if (x < mn) { mn = x; }; }; printf("minimum is: %d", mn); printf(

PHP image_jpeg dont' work if file is UTF-8, works if it's ANSI

半腔热情 提交于 2019-12-24 08:21:05
问题 I use this class to crop, resize my image: http://www.phpclasses.org/package/4268-PHP-Resize-crop-rotate-flip-flop-and-grey-images.html It uses GD. The problem is that I for example do this: $img = new ImageTransform; $img->view('resize', 'foo.jpg', '500x400', true); // true argument is $cache = true Now I can just point <img src="that_script.php" alt="" /> and it will show that image resized. But it doesn't if all my files are UTF-8! Only if they ALL are ANSI encoded. The image simply won't

C# - Get ANSI code value of a character

北城余情 提交于 2019-12-24 03:47:07
问题 I'd like to retrieve the ANSI code value of a given character. E.g. when I now get the int value of the trademark character, I get 8482. Instead I would like to get 153, which is the value of the trademark character in codepage 1252. Some help would be appreciated. Jurgen 回答1: Found it myself: Encoding ansiEncoding = Encoding.GetEncoding(1252); byte[] bytes = ansiEncoding.GetBytes(c); int code = bytes[0]; 来源: https://stackoverflow.com/questions/12370812/c-sharp-get-ansi-code-value-of-a

Cast to type known only at runtime

跟風遠走 提交于 2019-12-24 00:59:22
问题 let's say I have the following : void *pA; now I want at runtime to convert this pointer to a type that is not known at compile time. i.e. what is the equivalent or how to emulate in ANSI C a c++ dynamic_cast ? Thanks ! 回答1: now I want at runtime to convert this pointer to a type that is not known at compile time. i.e. what is the equivalent or how to emulate in ANSI C a c++ dynamic_cast ? Well, that's not what dynamic_cast does. You cannot cast to a type which is not known at compile time.

Is this valid ANSI C++ code? Trying to generate offsets of structure members at compile-time [duplicate]

浪尽此生 提交于 2019-12-23 04:46:02
问题 This question already has answers here : Closed 8 years ago . Possible Duplicates: Does the 'offsetof' macro from <stddef.h> invoke undefined behaviour? dereferencing the null pointer #define _OFFS_OF_MEMBER(p_type, p_member) (size_t)&(((p_type *)NULL)->p_member) struct a { int a, b; }; size_t l = _OFFS_OF_MEMBER(struct a, b); I had a little chat/conversation with some fellow users, and one of them said that this is dereferencing and accessing the address space near address NULL. I said: