c

Simple auto updater for OpenVPN config files

Hi, We have deployed several OpenVPN servers globally and our 8k+ Windows users have OpenVPN GUI installed. Each server is defined in a config file in the program files directory. As we add new servers to the network (we require almost a dozen globally) we would like a slick solution to auto update the config directory with the new conf...

Reading a string is not going properly

Hey guys, i'm working on a program that gets a postfix expression and calculates it.. I have two functions: Converts infix to postfix Calculate the postfix When I try small expressions, like 1+1 or (1+1)*1, it works fine but when i use all the operands I get something nasty, Here is the example: 2*2/2+1-1 gets something like: 222/*...

ANSI C: Passing array by value generates wierd error I can not solve.

When I declare this function: void vLFSR_ParseInput(unsigned char * pucDataArray,unsigned char unCount){} and try to pass it this array unsigned char g_ucUSCI_A0_RXBufferIndex = 0x00; unsigned char g_ucaUSCI_A0_RXBuffer[RXBUFFERSIZE]; with this function call vLFSR_ParseInput(&g_ucaUSCI_A0_RXBuffer,g_ucUSCI_A0_RXBufferIndex); ...

Recursive dependency found in a makefile for creating a static library

I have 4 .c files hello.c,here.c,bye.c and main.c. One header file mylib.h The contents are as follows hello.c #include<stdio.h> void hello() { printf("Hello!\n"); } here.c #include<stdio.h> void here() { printf("I am here \n"); } bye.c #include<stdio.h> void bye() { printf("Bye,Bye"); } main.c #include<std...

Creating integer variable of a defined size.

I want to define an integer variable in C/C++ such that my integer can store 10 bytes of data or may be a x bytes of data as defined by me in the program. for now..! I tried the int *ptr; ptr = (int *)malloc(10); code. Now if I'm finding the sizeof ptr, it is showing as 4 and not 10. Why? ...

creating attributes in sysfs

I am just trying to add a simple attribute to a device in the /sys filesystem. Seemed pretty straightforward but none of the helper methods mentioned here or here are exported from the kernel so I can't use them from a module? I must be missing something, can anyone provide some insight? ...

howto Enter into chroot environment from C ?

Hello all, what i am try to do is to get my program to enter chroot environment and do some commands and then exit. For Example #include <stdlib.h> #include <stdio.h> #include <string.h> #define ChRoot "sudo chroot \"/\" /usr/bin/env -i HOME=/root TERM=\"$TERM\" PATH=/bin:/usr/bin:/sbin:/usr/sbin:/bin /bin/bash --login +h" void ...

is int by default long int in C?

Why is it that I'm finding the size of int and long int are shown to be 4 bytes? Is it that the int is by default long int? ...

Why does CC not see my function definition in header?

Hello.. I'm writing a simple application in ANSI C. I am using GCC in a Unix environment. I have the following sample application: //main.c #include "foo.h" int main() { int result; result = add(1,5); return0; } Header: //foo.h #ifndef FOO_H_INCLUDED #define FF_H_INCLUDED int add(int a, int b); #endif ...

Undefined reference error in a makefile while creating static library

I have 4 .c files hello.c,here.c,bye.c and main.c. One header file mylib.h The contents are as follows hello.c #include<stdio.h> void hello() { printf("Hello!\n"); } here.c #include<stdio.h> void here() { printf("I am here \n"); } bye.c #include<stdio.h> void bye() { printf("Bye,Bye"); } main.c #include<std...

Converting C hilbert's curve implementation into PHP

Hi everyone. Couple of years ago i found a space filling curve implementation (Hilbert's) written in C designed to plot IP addresses. (I can't seem to find it again). I would like to convert this into PHP, returning a coordinate on an arbitrary grid. I found this question that is very related. This is a longshot, but i figured someone ...

Why won't my value increment? Memory stomping/stack glitch?

I've come across a rather charming bug that I'm trying to wrap my head around. I feel like I've seen this before, but this time I want to understand why this is happening. I have: int i; int debug = 0; for(i = 0; i < buf_end; i++) { do_some_buffer_work(); if(something_is_true()) { do_something_important(); pr...

Resizable Side Window

Is there any way to create a child window that is resizable only on the right edge and covers up a part of the left side of the parent window? Similar to that of Firefox's History panel. ...

Measuring time taken by a function: clock_gettime

Hi, I am trying to measure how long a function takes. I have a little issue: although I am trying to be precise, and use floating points, every time I print my code using %lf I get one of two answers: 1.000... or 0.000.... This leads me to wonder if my code is correct: #define BILLION 1000000000L; // Calculate time taken by a reques...

C - Losing pointee struct values

**Updated. Sorry to those whose answers no longer make sense. So I figured out that no matter what I put on the line after Data_pair_node, after it executes, thats when the thing is reset! WTH? : int insert(Table *t, const char *key, const char *val){ int dest_bucket_index; Table *table = t; Hash_bucket *dest_bucket = NULL; Data_pa...

Issue with threads: value stored in heap

Hello, I have an issue with threads. I am defining a global variable, a char * that I initialize to NULL, and a mutex. pthread_mutex_t mutex; char *minURLTime; minURLTime = NULL; Then I initialize my mutex: pthread_mutex_init(&mutex, NULL); I then create a new thread: void *status; pthread_t t; pthread_create(&t, NULL, executeTh...

problems in select() and sending a signal SIGUSR1 in the end (C language)

HI, I'm implementing a classical map-reduce program in which I have a parent that spwans N children(maps) + 1(reduce). The parent sends info, through unnamed pipes, to each one of the N children. The maps process the request and send the result, an int, to reduce. The reduce does a select and sums up every counter writen on the pipes fr...

Makefile Error : Command Not Found- while creating a shared library

I have 4 .c files hello.c,here.c,bye.c and main.c. One header file mylib.h The contents are as follows hello.c #include<stdio.h> void hello() { printf("Hello!\n"); } here.c #include<stdio.h> void here() { printf("I am here \n"); } bye.c #include<stdio.h> void bye() { printf("Bye,Bye"); } main.c #include<std...

C Socket program - How can I accept user input while updating reading from stdout?

I have written a little irc bot application in C. It just writes out the server messages to the screen. This is just accomplished with a while loop that reads from the server filedescriptor. How can I concurrently accept input? I would like to now extend it to accept user input so that it can be used as a client application. I am new to ...

Which IDE are you using under Unix/Linux for visual debugging?

I usually build the application in windows and test /port the application in UNIX using VI But what is I need to build the application from scratch in unix/linux in shell what option do I have to Visually debug (break point and such .. ) or syntax helpers? ( c/c++) ...