The prototype for setsockopt is:
int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
Are the following all correct ? Which are not ?
a.)
int buffsize = 50000;
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&buffsize, sizeof(buffsize));
b.)
int buffsize = 50000;
setsockopt(s, SOL_SOCKE...
There is a simple Client-Server program.
The server is started $./server 5000
The client is also connected to server.. $./client 127.0.0.1 5000
The client enters a string
Client has the message "I got your message" displayed on his terminal & server displays the entered string by the client
The issue is that when I run client by doi...
I'm looking for a UUID library for programming in C, that has a reasonable probability of being installed (or at least installable by package manager) on most modern Linux desktops, and works with pkg-config.
The following two possibilities seem most obvious:
OSSP UUID
Libuuid from e2fsprogs
Does anybody have experience with these t...
Hi, everyone:
As the title described, how to use c library function fgets in assembly language? Indeed, I want to know how to get the file pointer to stdin. Thanks for your reply.
...
Below is a pared-down (error/null checks omitted) snippet of C/Obj-C code that uses sysctl to get the argv of a particular process with PID 50.
...
int getProcessArgs[3] = { CTL_KERN, KERN_PROCARGS, 50 };
sysctl(getProcessArgs, 3, NULL, &length, NULL, 0);
char* processArgs = malloc(length * sizeof(char));
sysctl(getProcessArgs, 3, proce...
I want to get a monotonic clock on IRIX, like:
clock_gettime(CLOCK_MONOTONIC, &t);
But CLOCK_MONOTONIC doesn't exist on IRIX.
It has CLOCK_SGI_CYCLE, but that (as the names says) cycles too often (about every 90s on my machine in case you're interested).
Is there any other (fairly high-res) clock that I can use, that isn't affected ...
I have a program I am trying to debug, but Dynamic C apparently treats strings differently than normal C does (well, character arrays, anyway). I have a function that I made to make an 8 character long (well, 10 to include the \0 ) string of 0s and 1s to show me the contents of an 8-bit char variable. (IE, I give it the number 13, it r...
OpenCV
GIL
Is there some experienced user can share it?
I need to know the difference to decide which to choose.
...
Today something strange came to my mind. When I want to hold some string in C (C++) the old way, without using string header, I just create array and store that string into it. But, I read that any variable definition in C in local scope of function ends up in pushing these values onto the stack.
So, the string is actually 2* bigger t...
I have a very simple binary tree structure, something like:
struct nmbintree_s {
unsigned int size;
int (*cmp)(const void *e1, const void *e2);
void (*destructor)(void *data);
nmbintree_node *root;
};
struct nmbintree_node_s {
void *data;
struct nmbintree_node_s *right;
struct nmbintree_node_s *left;
};
So...
I've searched on google and haven't been able to come up with a solution.
I would like to compile some OpenGL programming using GCC. In the GL folder in GCC I have the following headers:
gl.h
glext.h
glu.h
Then in my system32 file I have the following .dll
opengl32.dll
glu32.dll
glut32.dll
If I wanted to write a simple OpenGL "He...
I am just wondering if you are supposed to write a sort of really secure application with data being transmitted over insecure networks, what kind of encryption algorithm will you use it in order to make it safe ? I know several c++ libraries for encryption providing nice functions with different algorithms, but i'm not quite sure which ...
You know we can use message queues with the function mq_receive(); what is a good way to implement that functionality (you know, waiting until the shared data is changed) with semaphores?
...
Dear ninjas / hackers / wizards,
keywords: bignum, bigint, GMP, MPFR, decNumber, BigInteger, BigDecimal, java.math.BigInteger, java.math.BigDecimal, System.Numerics.BigInteger
I'm looking for a good arbitrary precision math library in C or C++. Could you please give me some advices / suggestions?
The primary requirements:
It MUST ha...
Linux's stddef.h defines offsetof() as:
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
whereas the Wikipedia article on offsetof() (http://en.wikipedia.org/wiki/Offsetof) defines it as:
#define offsetof(st, m) \
((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
Why subtract (char *)0 in the Wikipedia version? I...
I've got some custom metadata to put into a PNG file. It's being saved through libpng, and it's not difficult to write out a custom chunk. I just call png_write_chunk with the name, length and data. But I can't see how to get the data back out again. I'd expect there to be a png_read_chunk function that takes a chunk name and returns...
I'm trying to identify when a particular process is running, based on its arguments, on Mac OS X. There may be several processes running with the same name, but only one will have the arguments I'm looking for. The processes are not owned by the same user who will be running my code. They will not have modified their argv in any way.
...
For fun I'm trying to write a very simple server in C.
When I send this response to Firefox it prints out the body "hello, world" but with Chromium it gives me a Error 100 (net::ERR_CONNECTION_CLOSED): Unknown error.
This, I believe, is the relevant code:
char *response = "HTTP/1.0 200 OK\r\nVary: Accept-Encoding, Accept-Language\r\nC...
So my programm generates JPegs and MP3 stereo track. I want to convert my programm results with FFMPEG to h264+aac or OGG (vorbis+theora) 100 seconds video. So how to do It from commandline at least (or using pure ffmpeg lib from C)?
...
How can I do this cleanly without gotos?
loop:
if(condition1){
something();
} else if (condition2) {
somethingDifferent();
} else {
mostOfTheWork();
goto loop;
}
I'd prefer not to use breaks as well. Furthermore, it is expected to loop several (adv 40) times before doing something else, so the mostOfTheWork pa...