Time stamp in the C programming language
How do I stamp two times t1 and t2 and get the difference in milliseconds in C? ...
How do I stamp two times t1 and t2 and get the difference in milliseconds in C? ...
We recently completed an analysis of multicast sending performance. Happily, Java and C performed almost identically as we tested different traffic sending rates on Windows and Solaris. However, we noticed that the time to send a multicast message increases as the time between sends increases. The more frequently we call send, the le...
I am writing simple client-server program. Client send some messages to server using UDP or TCP. Server must be able to support both UDP and TCP. If client, sends message using UDP, sequence of method calls in client is socket(),bind(),sendto(),recvfrom(),close() and that in server is socket(),bind(),sendto(),recvfrom(),close(). If it...
Hello, in my application I need to store settings that are 'global' (i.e. not user specific) in a known and predictable location. I want the application to be able to be run from anywhere (as a standard user, NOT administrator), including multiple copies from different locations and be able to read and write the saved config files. The...
Hi, I have a small program that sends and receives data from server and client and vice-versa. Everything works fine, but I can't see received messages in both sides and it is always 0 bytes. It doesn't give any compile error but doesnt work the way I wanted to. Can you please have a look at this, where I am doing wrong ? Thanks // clie...
I'm programming in C here, for Windows and various Unix platforms. I have a set of structs that have common fields, but also fields that are different. For example: typedef struct { char street[10]; char city[10]; char lat[10]; char long[10]; } ADDR_A; typedef struct { char street[10]; char city[10]; char z...
Hello, I am going over C and have a question regarding const usage with pointers. I understand the following code: const char *someArray This is defining a pointer that points to types of char and the const modifier means that the values stored in someArray cannot be changed. However, what does the following mean ? char * const arr...
I declared a 2-dimensional array like this: char *array[][3] = { {"a", "b", "c"}, {"d", "e", "f"}, {"u", "v", "w"}, {"x", "y", "z"}}; How do I find out the first dimension? ...
I am aware of a related question where someone mentioned the clang static analyzer but gave no further comments. Most of answers pointed to the lint family which disappointed me from time to time due to the bulk of false positives. I noticed the clang static analyzer when I read XCode release notes. I have tried it and it only produced ...
I use getpwnam_r to handle client connections in my programs. Sadly enough, it seems to allocate a buffer it never frees. The relevant valgrind output: ==15774== 536 (104 direct, 432 indirect) bytes in 2 blocks are definitely lost in loss record 1 of 3 ==15774== at 0x4C24CFE: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memc...
I have a very difficult problem I'm trying to solve: Let's say I have an arbitrary instruction pointer. I need to find out if that instruction pointer resides in a specific function (let's call it "Foo"). One approach to this would be to try to find the start and ending bounds of the function and see if the IP resides in it. The star...
hey there, just practising and I had a question. I have a program (source below) that prints out a wave in text. when the wave hits the outside of the terminal I have it make a noise with a function called noise(). but when that function is called it pauses the animation until it completes making the noise, then the animation starts agai...
Does anyone know of a best practices guide for deploying native (no COM, no .NET) ANSI C Windows shared libraries? Our product uses zlib and we distribute pre-built binaries on our downloads page that differ from those on the official zlib page. I'm guessing that the reason for this is to avoid mixing C runtimes. The official ones are...
How does relloc behaves when it has to resize the allocated memory to a bigger size and it has to be done in a separate memory area as the requested amount of memory can be resized inplace. Does the original memory is deallocated automatically by relloc (I would think so ) or it has to be done by the programmer (not likely) ? ...
What's the best free cross-platform c99 (or earlier) library for getting sound input (microphone, etc)? ...
With the following Grammar, I get a syntax error with this sort of input: ls /home > foo #Runs and works okay, but raises error token ls /home /foo /bar /etc #works okay I think it may have something to do with how lookahead works, but this is my first grammar and I am a bit confused about why it doesn't work this way: external_cmd G...
How to understand following complicated declarations? char (*(*f())[])(); char (*(*X[3])())[5]; void (*f)(int,void (*)()); char far *far *ptr; typedef void (*pfun)(int,float); int **(*f)(int**,int**(*)(int **,int **)); EDIT : After people have cursed me, I am tagging this as homework question. :-) ...
I try to avoid asking school specific problems on Stackoverflow, but I've ran into a bit of a problem, and was hoping someone here might be able to point me in the right direction. I'm currently doing a Graphic Programming class in college independently (no class, just me, a book, and the teacher). However, the professor doing this is ...
I'm getting the slope of a line bounded by two points float slopeXY(CGPoint p1, CGPoint p2) { return ((p2.y - p1.y) / (p2.x - p1.x)); } If I give it a zero-sized line, CGPoint p1 = CGPointMake(0, 10); CGPoint p2 = CGPointMake(0, 10); float sxy = slopeXY(p1, p2); I don't get a divide by zero error. ...
extern int ether_hostton (__const char *__hostname, struct ether_addr *__addr) __THROW; I found the above function definition in /usr/include/netinet/ether.h on a Linux box. Can someone explain what the double underscores mean in front of const (keyword), addr (identifier) and at last __THROW. ...