c

What happens from the moment we press a key on the keyboard, until it appears in your word document

This question was in my job interview.. I just to see whether I gave all the details... ...

Can't detect the first data sent in the serial port.

Hi, I am using C language and Linux as my programming platform. And I have problems in setting up the serial port(/dev/ttyS0). In my small program, I set my serial port using tcgetattr and tcsetattr options.c_cflag |= B115200; options.c_cflag &= ~PARENB; options.c_cflag &= ~CSTOPB; options.c_cflag &= ~CSIZE; options.c_cflag &= ~CRTSCTS...

Do you really need to know C/C# to code in Objective-C (iPhone) ?

Do you really need to? I had no idea what C/C# was when I first started learning Objective-C, and I still don't feel comfortable with C/C#, but I am almost finished on my second iPhone App allready, without knowing C. I know that Objective-C is based on C/C# (deep down), but still. Do you think you really need to learn C/C# before lear...

Changing ECC code of a block

Hi , can I change the ECC code for a block of a file stored on a flash drive by any means ? of a file stored on a HDD (though I don't think there would be a difference between the two) Maybe , through some hardware interrupts or anything like that? Also I need the solution to be in C/C++. ...

(Embedded) C: void function() or #define FUNCTION()

Hi, im programming embedded devices and I was wondering what to use for a macrofunction, for example an init of some registers. should i make this static/const or define it as a macro? for example, this: #define FPGA_INIT()\ { \ /* Set function and direction of start_code pin*/\ P0SEL &= ~0x04; \ P0DIR |= 0x04; \ FPGA_START_CO...

Is the SRV_PROC Structure Compatible With Oracle's Extended Stored Procedure?

In a SQL Server external stored procedure(written in C) that I am trying to migrate, the SRV_PROC structure is the entrance parameter for a used method. Is it possible to call this method in Oracle or do I have to change the data type into something else? Is there any workaround for this situation? ...

Low pass filter using FFT instead of convolution implementation

Implementing a low pass FIR filter, when should one use FFT and IFFT instead of time-domain convolution? The goal is to achieve the lowest CPU time required for real-time calculations. As I know, FFT has about O(n log n) complexity, but convolution in the time domain is of O(n²) complexity. To implement a low pass filter in the frequen...

How to redefine a macro using its previous definition

Suppose I have the following macro: #define xxx(x) printf("%s\n",x); Now in certain files I want to use an "enhanced" version of this macro without changing its name. The new version explores the functionality of the original version and does some more work. #define xxx(x) do { xxx(x); yyy(x); } while(0) This of course gives me red...

Faster way of finding multiple of double

If have the following C function, used to determine if one number is a multiple of another to an arbirary tolerance #include <math.h> #define TOLERANCE 0.0001 int IsMultipleOf(double x,double mod) { return(fabs(fmod(x, mod)) < TOLERANCE); } It works fine, but profiling shows it to be very slow, to the extent that it has become a...

How to use SSE with both Windows compiler and GCC compiler?

I have to optimize a piece of code using SSE extensions. My target platforms are Windows and Linux, so I build my application using MS compiler (VStudio) and GCC compiler. What approach does exist to involve SSE? I can find a lot of examples how to use SSE with GCC, but they seem to be incompatible to be used with MS compiler. Does exis...

swprintf chokes on characters outside 8-bit range

This happens on OS X, though I suspect it applies to any UNIX-y OS. I have two strings that look like this: const wchar_t *test1 = (const wchar_t *)"\x44\x00\x00\x00\x73\x00\x00\x00\x00\x00\x00\x00"; const wchar_t *test2 = (const wchar_t *)"\x44\x00\x00\x00\x19\x20\x00\x00\x73\x00\x00\x00\x00\x00\x00\x00"; In the debugger, test1 look...

obfuscated C/asm "Hello, world!" program, I don't understand.

why does the following code print "Hello, world!" (on "my" system)? .file "test.c" .globl main .data .align 32 .type main, @object .size main, 56 main: .value 3816 .value 0 .value 18432 .value 27749 .value 28524 .value 8236 .value...

C++ add linux user

Hello, Whats the best way to add a user/group in linux using C++ is there a library I can call on? I dont want to start doing things like: fopen("/etc/passwd", "a"); fprintf(tmp, "%s:x:%d:1:%s:/%s/%s:/bin/ksh\n", username, usernumber, commentfield, userdir, username); fclose(tmp); fopen("/etc/shadow", "a"); fprintf(stmp, "%s:*LK*::...

C function declaration

Is it necessary to declare function before using it? Does the compiler give an error if we don't use a function declaration and call it directly. Please answer according to standard C. If yes then what does it mean that argument of type are converted to int and float to double if arguments to function are not defined? ...

What algorithms to use for image downsizing?

What algorithms to use for image downsizing? What is faster? What algorithm is performed for image resizing ( specially downsizing from big 600x600 to super small 6x6 for example) by such giants as flash and silver player, and html5? ...

How to create a new Linux kernel scheduler

Looking through the scheduler source code (2.6.34, kernel/sched.c), I can see how the "pluggable" schedulers are used, and I believe I understand the interface to be implemented. What I don't understand yet is how to get my code built into the kernel. At the very least, pointers to other sites would be appreciated. Right now, I'm grep...

c union and bitfields

Can bitfields be used in union? ...

Writing and debugging ansi c code in Visual Studio 2005

I'm writing an ansi c program in vs2005. Everything compiles ok and I can run the program from command line. BUT, if I run it inside the IDE then the app finishes and closes - ignoring all break points. why? help! ...

Reading a file with variable line lengths line by line in c

Hey everyone, In C, is there a way to read a text file line by line without knowing how much space to allocate for it? here's an example of what I mean: fgets(line, <dynamic line size>, fileHandle); Thanks for the help! ...

does free always (portably) frees & reserve memory for the process or returns to the OS

I have read that free() "generally" does not return memory to the OS. Can we portably make use of this feature of free(). For example,is this portable? /* Assume I know i would need memory equivalent to 10000 integers at max during the lifetime of the process */ unsigned int* p = malloc(sizeof(unsigned int) * 10000); if ( p == ...