c

Checking whether two numbers are permutation of each other?

Given two numbers a, b such that 1 <= a , b <= 10000000000 (10^10). My problem is to check whether the digits in them are permutation of each other or not. What is the fastest way of doing it? I was thinks of using hashing but unable to find any suitable hash function. Any suggestions? For e.g - 123 is a valid permutation of 312 A...

stdlib and colored output in C

I am making a simple application which requires colored output. How can I make my output colored like emacs and bash do? I don't care about Windows, as my application is only for UNIX systems. Thanks. ...

How can I pass map<string,string> into py with API?

C/C++ can use python API to load py. But, only simple type is supported. How can I pass map into py to be a dict with API? Or, which methods are better? ...

Get Exif information

Hello, In my application i need to get EXIF information. What libs are exist for working with EXIF data, withou libexif? Thank you ...

Can i take package of cpython?

I used cpython api to load py from C/C++. But, if i want not setup cpython in client, can I take package dll of cpython in my program? How to do that? ...

Pointer help in C/C++

I want to know about the pointer in C and C++ - how does it help in saving memory? I searched but did not get a satisfactory answer. Please help me out. ...

enable auto-completion for C in Mono Develop

I need to enable Auto completion for C programs in Mono - I think using CTAG? How can I do that? ...

Cannot run program "make": The system cannot find the file specified?

This is the first time that this error has come up. I am using Cygwin with Eclipse 3.5 and my Path variable is set to: %CommonProgramFiles%\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Prog...

GCC compilation error

When I tried to compile a program this came up: C:\Users\Mohit\Developer\C_Workspace\iPhoneInteraction\Debug>make all Building file: ../src/test.c Invoking: Cygwin C Compiler gcc -I"C:\cygwin\usr\include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"s rc/test.d" -MT"src/test.d" -o"src/test.o" "../src/test.c" cygwin warning: MS-D...

how to find leap year?

i made a program to find if the entered year is a leap year or not but its not working well.it says a year is leap and the preeceeding year is not leap #include<stdio.h> #include<conio.h> int yearr(int year); void main(void) { int year; printf("Enter a year:"); scanf("%d",&year); if(!yearr(year)) { printf("It...

Is the gettimeofday function thread safe in Linux?

The current time must be stored globally in order for gettimeofday to work, however I am not sure if the function modifies any global state so that concurrent execution is undefined. ...

Question on lexical analysis

I am reading the dragon book. Quoting the text from the book (3.1.4 Lexical errors, Pno 114) It is hard for a lexical analyzer to tell, without the aid of other components, that there is a source-code error. For instance, if the string fi is encountered for the first time in a C program in the context: fi ( a == f(x) ) ....

Micrium uC-OS/II on Dynamic C/Rabbit - might have task starvation

Hi All, I'm trying to get 2 tasks to run in my Dynamic C under Micrium uC-OS/II. One task is the http handler, the other reads from the serial port. The serial port task seems to inhibit the http task from running. Any ideas why this is? I thought uC-OS/II was preemtive. void httptask(void* ptr) { http_init(); while(1) { http_...

The best zip library with public domain license

Does anyone know zip library of C/C++ in public domain license? It meets the following requirements. It operates by the unit like stb_image.c library Supported cross platform. Windows, Mac, Linux and so on. Language is C/C++ License is public domain. ...

define variable size on array in local memory, using CUDA

Is it somewhat possible to make a list, array, something in a device function with the size of the list/array beeing a parameter in the call… or a global variable that's initialized at call time? I would like something like one of these list to work: unsigned int size1; __device__ void function(int size2) { int list1[size1]; ...

One time Hook DLL initialization

My program uses SetWindowsHookEx to set a global hook function in my DLL. However I want the DLL to work with a file so I need it a file to be opened once. I can't use DllMain's DLL_PROCESS_ATTACH because it's called multiple times. What is the best solution to my problem? ...

How to pass a double array to a function in C?

I have been trying to solve this problem the whole day: How do I pass a double array to a function? Here is an example: int matrix[5][2] = { {1,2}, {3,4}, {5,6}, {7,8}, {9,10} }; And I wish to pass this matrix to function named eval_matrix, void eval_matrix(int ?) { ... } I can't figure out what should be in place of ? Can a...

counting newlines, spaces, and tabs

This problem is from K&R p. 20: Write a program to count blanks, tabs, and newlines. Here's my attempt: #include <stdio.h> int main() { int character, whitespace = 0; printf("Enter some text, and press Ctrl-d when you're done.\n\n"); while((character = getchar() != EOF) { if(character == (' ' || '\n' || '\t')) { ++wh...

Help Needed to display stack of cards using GTK!

Hey Guys, I am building a cards game which displays a stack of Cards( Some thing like Solitaire). I was wondering you give me some advise regarding it? Also if you could direct me to a tutorial for stuff like these( I am already going through the gtk doc). ...

off_t without -D_FILE_OFFSET_BITS=64 on a file > 2GB

1- I'm wondering, what would be the problem if I try to read a file greater than 2GB in size without compiling my program with the option -D_FILE_OFFSET_BITS=64 using off_t and using the second function on this page? would it segfault? 2- I'm planning to use this implementation with off64_t and #define _LARGEFILE64_SOURCE 1 #define _F...