Variables of type int are allegedly "one machine-type word in length"
but in embedded systems, C compilers for 8 bit micro use to have int of 16 bits!, (8 bits for unsigned char) then for more bits, int behave normally:
in 16 bit micros int is 16 bits too, and in 32 bit micros int is 32 bits, etc..
So, is there a standar way to test it,...
I've got a little C server that needs to accept a connection and fork a child process. I need the stderr of the child process to go to an already existing named pipe, the stdout of the child to go to the stdout of the parent, and the stdin of the child tp come from the same place as the stdin of the parent.
My initial attempts involved...
Possible Duplicates:
While vs. Do While
When should I use do-while instead of while loops?
I've been programming for a while now (2 years work + 4.5 years degree + 1 year pre-college) and I've never used a do-while loop short of being forced to in the Introduction to Programming course. I have a growing feeling that I'm doin...
Hi,
I had a job interview today, we were given a programming question, and were asked to solve it using c/c++/Java, I solved it in java and its runtime was 3 sec (the test was more 16000 lines, and the person accompanying us said the running time was reasonable), another person there solved it in c and the runtime was 0.25 sec, so I was ...
I once seen a -wired- operator in C++ which assigns value if greater than..
it was a combination of ?, < and =
e.g. let x = value if value is greater than x
I do not mean x=(x<value)x:value
It was some sort of x<?=value
But I can not remember it exactly, and can not find it online... Can some one remind me of it?
Thanks,
...
Is there a way to setup a network connection that uses a socks4a in any of the Mac OS X api's or maybe even an external library that I can use?
I found that NSStream can use a socks4 or socks5 proxy but there was nothing about socks4a in the documentation that I could find.
...
How do i get the current time of a different time zone? Example, i need to know the current time in Singapore where as my system is set to PT time.
...
How can I access an interrupt vector located at the machine's location 0? If I set a pointer to 0, the compiler might translate it to some nonzero internal null pointer value.
...
I have been trying to find out how to programmatically interact with Component-Based Servicing (CBS) which is basically the TrustedInstaller and other services. With the goal to be able to query CBS for what packages are installed and get any other information they may have on installed packages. Here is a link to a overview of it.
Bas...
So I have some uint8_t buf or FILE buf with FLV Video tag. We know its a video tag but we do not know in what codeck it is. We know its with a Key frame.
How using FFmpeg C librarys to decode that encoded frame into RGB or YCbCr?
...
What's the difference between fgetpos/fsetpos and ftell/fseek?
What are fgetpos and fsetpos good for?
...
I thought one could initialize several variables in a for loop:
for (int i = 0, char* ptr = bam; i < 10; i++) { ... }
But I just found out that this is not possible, gcc gives the following error:
error: expected unqualified-id before 'char'
Is it really true that you can't initialize variables of different types in a for loop?
...
Assume we capture packets with the C API of libpcap. Is it efficient to parse some payload strings with string search strstr() in line speed (e.g. Mbps/Gbps)? For example strstr(payload,"User-Agent");
Would it be more efficient to do it with a regular expression pattern matching library, such as libpcre?
If we want to do that only for ...
I am using a variable-sized C struct, as follows:
typedef struct {
int num_elems;
int elem1;
} mystruct;
// say I have 5 elements I would like to hold.
mystruct * ms = malloc(sizeof(mystruct) + (5-1) * sizeof(int));
ms->num_elems = 5;
// ... assign 5 elems and use struct
free(ms);
Will this last free() free every...
I'm making an application that draws shapes and I use a camera to draw in other places. Basically, let's say I have a 4x3 rectangle and would like to use glgetpixels to get all the pixels for something that is 1024x768, but my monitor might not support that resolution. How can I render something bigger than the monitor. I do this so I ca...
I've been working through a small tutorial on how to build a basic packet sniffer for Linux. I got everything working, and I now want to add IP-to-host mapping.
Everything was working before I added this function:
void IPtoHostname(char *ipaddress, char *hostname){
struct hostent *host;
in_addr_t ip = inet_addr(ipaddress);
...
I am looking for a command-line tool that removes all comments from an input
file and returns the stripped output. It'd be nice it supports popular
programming languages like c, c++, python, php, javascript, html, css, etc. It
has to be syntax-aware as opposed to regexp-based, since the latter will catch
the pattern in source code strin...
I got this code.. now the challenging part is my prof asked me to make a program which asks the user to input an uppercased word.
The problem is, she wants the program to automatically transform each inputted letter in uppercase even if the user's keyboard is not in capslock mode.. so i don't know what's really wrong with my program......
How could I implement in C a simple way to generate the 2 missing control points for an elliptic arc given a start and end point? I don't need fancy error estimation, just something that can take points A and D and generate the control points B and C for the elliptical arc where I can then use the cubic bezier interpolation algorithm to ...
I've seen a lot of questions and answers on SO about why I should learn C. I know that it's low level, it'll give me an understanding of how things work at that level, and it'll make me a better programmer. I know some good books to be reading to help me learn C.
What I don't feel like I know are some practical projects I can work on to...