I have this requirement wherein I have to increment the value of a POSIX semaphore by more than 1.
Apparently, there is no way in POSIX specification to do this. There is no sem_setvalue() similar to sem_getvalue(). I do not want to go back to System V semaphores just because of this constraint.
Is there any alternative way to acco...
I know that each programming language has certain guideline and styles. My question is about two languages that I write code in, that isn't very popular or documented.
I know this topic is very broad, and everyone has their own unique way of doing things. What I would like is to hear advantage, disadvantages to certain styles.
In orde...
I want to send a character array over a tcp socket in unix.
My first idea was to use an ordinary char array for the struct that will be sent over the socket:
typedef struct __attribute__((packed))
{
uint8_t type;
uint8_t id_index;
char char_value[STR_MSG_MAX];
} a_msg;
Simply because a C char is always 8 bit long. However, a...
I got this answer from Kjensen and read the answers, but this is a different webapp
I'm running scheduled events that process incoming orders, set Picking material, manage Track & Trace numbers, etc ... and I do this at a specific time of the day (set in Administration Panel)
My server is in UK (DiscountAsp.net) but I'm 2 hours ahead.
...
Hello all
im porting c code to windows 32 bit using visual studio express
now i have 3 functions that i can't find any alternatives in windows
they are:
alarm
bzero
bcopy
what are the equivalent methods in C win32 ?
...
I have programm writting with C, and I want just only function in oher processor.
Does anyone know how to be thread-distribution for multi-core processors work?
Can a current thread running on the times one, sometimes on the other core, depending on how busy the nuclei
are straight?
Add Reply
...
Hi, I am writing an advanced calculator in C. As you can guess, it currently has many functions, and I use a switch to do the proper operation for every function name. It goes something like this:
switch(hash_of(function_name_currently_being_parsed))
{
case HASH_COS:
// do something
break;
case HASH_SIN:
// do something...
What kind of algorithm should i use to calculate 2^n . . Where n is always greater than 100 . . Suggest a good algorithm using c :)
...
how can i find my processor speed and capacity of RAM using C program
...
Hi, maybe stupid question, but i dont know answer. What is difference between using GetModuleHandle or LoadLibrary to load dll(and then to use function of that dll) and to include directly desired header. For example, with using GetModuleHandle:
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
// Call GetNativeSystemInfo if supported or Ge...
Accidential use of classes inside of c style typeless variable arguments list is a common error source.
Example:
class MyString {
public:
char *pChars;
int Length;
MyString(char *pChars) {
this->pChars = pChars;
Length = strlen(pChars);
} };
int main() {
MyString s1("Bla1"), s2("Bla2");
...
I want to clean all files in a directory on Linux (not deleteing them, only clear their content)
I need to do it in C.
...
What would it take to port libeio to windows?
...
I know this one has been asked before, however I can't seem to find a suitable solution, so I 'll state the problem:
I have a string of characters that is similar to an XML file. It's not an XML string, but it has opening and closing tags. All the information resides in one single line, for example:
<user>username</username>random data...
Hi,
Can anyone please give me any good link where i can get some info on how to program with ptrace for HP-UX.
Please don't post links for linux ptrace.
...
hello i got a problem with returning an array of linklists in c
lets say i got
arrlinklist = {linklist1 , linklist 2...,linklist5}
and i want my function to return arrlinklist.
how do i do that... thx in advance.
...
Description:Play music directly to PC's Internal Speaker
I'm new to programming, with two months autodidact of C Programming. Can anyone help me to correct my writing of this procedure and run this program?
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<windows.h>
int CursoR(int CRx,int CRy){
COORD CursorPosition;
C...
I wrote a program to calculate nth root of a number upto 2 decimal places. eg 4th root of 81 is 3., 3rd root of 125 is 5.Its working nicely except for the 2nd root of 4. It's giving the output 1.99 instead of 2. Here is the code.
#include<stdio.h>
int main(int argc, char **argv)
{
double root1(int,int);
int n;
int num1;
...
Hello,
I have a C function which expects a list \0 terminated strings as input:
void external_C( int length , const char ** string_list) {
// Inspect the content of string_list - but not modify it.
}
From python (with ctypes) I would like to call this function based on a list of python strings:
def call_c( string_list ):
li...
Hello,
I am writing a utility which accepts either a filename, or reads from stdin
I would like to know the most robust / fastest way of checking to see if stdin exists (data is being piped to the program) and if so reading that data in. If it doesn't exist, the processing will take place on the filename given. I have tried using the...