Hi
I need to monitor folders on my linux machine periodically to check whether they are exceeding certain limits.
I have checked stat function call but running stat recursively on all sub folders and files is time consuming and I need to do this for all folders.
Does kernal maintain any datastructures which I can interpret in my progr...
My library contains a function that is used both internal and external. The function is so small that I want the compiler to try to inline function when called internal. Because the function uses information of an incomplete type external calls cannot be inlined. So my module should also always contain a copy of the function with externa...
Why can't we use return keyword inside ternary operators in C, like this:
sum > 0 ? return 1 : return 0;
...
How I can invent the problem logic for the given problem using Programming language-C. How to start thinking to solve the problem.. please suggest ideas or book names.
...
Hello,
I'm created table with one MEDIUMBLOB column and writing every second 2 images (16 or 32 KB) to this table. But random times i get Lost connection to MySQL server during query. Maybe i need to tune some mysqld server params or do something different ? I tested with local and remote mysqld server and i get same error.
My code t...
Hello
Once again, our best loved "i=i--" -like issues. In C99 we have:
6.5 Expressions #2: Between the previous and next sequence point an
object shall have its stored value
modified at most once
70) This paragraph renders
!!undefined!! statement expressions
such as
i = ++i + 1;
But for undefinded behavior there ca...
This is the program i have written can anyone tell what is wrong with it, because whatever input i give, it shows valid user.
#include<stdio.h>
#include<string.h>
#define max_size 20
void main()
{
File *Fptr;
char username[max_size];
char line[20];
if((fptr=fopen("/etc/passwd","r"))==NULL)
{
printf("cannot open file");
}
else...
I have a C program with multiple files, so I have, for example, stuff.c which implements a few functions, and stuff.h with the function prototypes. How should I go about documenting the functions in comments? Should I have all the docs in the header file, all the docs in the .c file, or duplicate the docs for both? I like the latter appr...
in c and/or c++: is it safe to cast an int to void pointer and back to int again?
based on this question: http://stackoverflow.com/questions/3567905/c-is-it-safe-to-cast-pointer-to-int-and-later-back-to-pointer-again
...
It's a FT2232D chip, and the LED is connected to BDBUS6.
The library is less documented than I might like (better than FTDI's own library though, which doesn't even work on modern kernels), the only example code I can find that does this uses a deprecated function (I tried, it doesn't seem to work), and I'm absolutely stumped.
The har...
My experience in C is mostly from second edition of The C Programming language which is a very old book. What has changed in C since it was released, what obsolete or deprecated functions should I avoid?
...
Been poking around google and haven't found any like what I'm after. so what is it I'm after? well two things:
firstly I'm looking for an
algorithm/pseudo-code/white-papers
to determine a best-fit color for a
give r,g,b tuple from and array of
256 RGB tuples.
Secondly, I'm looking for an
algorithm/pseudo-code/white-papers to
recolor a...
i have my code for transposing my matrix:
for(j=0; j<col; j++) {
for(k=0; k<row; k++) {
mat2[j][k] = mat[k][j];
}
it seems to work on a square matrix but not on a nonsquare matrix. help me guys!
...
Just out of curiosity, what is the preferred way to achieve interprocess synchronization on Linux? The sem*(2) family of system calls seem to have a very clunky and dated interface, while there are three ways to lock files - fcntl(), flock() and lockf().
What are the internal differences (if any) and how would you justify the usage of e...
I have problem and its about using IPERF . It sends one packet at a time so to use it to fuzz IPv6 I want to send 10000 or 1000000 packets at a time.
Tell me if it is possible to send such quantity of packets if not then atleast how can i test on IPERF?
Any sugguestions?
...
Hi Experts,
I'm not a software person, but I could really use some advice.
I'm writing a C program (cut/paste below) to establish a TCP socket connection from my Mac Pro to a Windows XP-based test-instrument sitting next to it over LAN (Ethernet). The program compiles without any warnings or errors. But executing the code using GNU Deb...
In my application I have to explicitly link to a dll. The application is in QT with gcc compiler.
The dll the application have to link to is a wrapper around another old dll. The purpose is to fit the old dll to a new interface.
I use implicit linking when compiling the new dll. The new dll is compiled with msvc 2008. The reason is th...
EDIT Public health warning - this question includes a false assumption about undefined behaviour. See accepted answer.
After a reading recent blog post, I've been thinking a lot about the practicality of avoiding all standards-undefined assumptions in C and C++ code. Here is a snippet cut out of C++, to do an unsigned 128-bit addition.....
hello,
I need help to find an algorithm that finds:
four elements in array
whose sum equal to a given number X
in O(n^2*log(n))
prefer in pseudo-code or c,c++
thanks
moti
...
In my copy of VS2010, stdlib.h contains (lines 353-355)
_CRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code);
_CRTIMP __declspec(noreturn) void __cdecl _exit(_In_ int _Code);
_CRTIMP void __cdecl abort(void);
I find it strange that there's no noreturn annotation on abort(). Does anyone know a reason for this? Is it a bug?
...