Hi,
I have a network software which uses UDP to communicate with other instances of the same program. For different reasons, I must use UDP here.
I recently had problems sending huge ammounts of data over UDP and had to implement a fragmentation system to split my messages into small data chunks. So far, it worked well but I now encoun...
i have an char array b[20] which i want to write into a file . After every iteration the value of b[20] changes , so i would like to write the string in each line of the file in each iteration . So how can i change a new line in a file and also put in a array of character?
...
I'm writing a calculator with an ability to accept new function definitions. Being aware of the need of newbies to try recursive functions such as Fibonacci, I would like my calculator to be able to recognize Tail-recursive functions with Flex + Bison and convert code to an Iterative form. I'm using Flex & Bison to do the job. If you hav...
Hi! I'm trying to parallelize a convolution function in C. Here's the original function which convolves two arrays of 64-bit floats:
void convolve(const Float64 *in1,
UInt32 in1Len,
const Float64 *in2,
UInt32 in2Len,
Float64 *results)
{
UInt32 i, j;
for (i = 0; i < in1Len;...
Hi,as an engineer I currently use C to write programs dealing with numerical methods. I like C as it's very fast. I don't want to move to C++ and I have been reading a bit about Ada which has some very good sides. I believe that much of the software in big industries have been or more correctly were written in Ada.
I would like to know...
#include<stdio.h>
/* this is a lexer which recognizes constants , variables ,symbols, identifiers , functions , comments and also header files . It stores the lexemes in 3 different files . One file contains all the headers and the comments . Another file will contain all the variables , another will contain all the symbols. */
int mai...
I have global static variables in a C library, which generate exceptions in a multithread run. I need to make them safe in some way (i.e., each thread should relate to a different instance of these variables). Any recommended methods?
...
this code is the base of lexer , and it does the basic operation of removing the whitespaces from a source file and rewrites it into another file with each word in separate lines .
But i am not able to understand why the file lext.txt not getting updated?
#include<stdio.h>
/* this is a lexer which recognizes constants , variables ,sym...
main.c (with all the headers like stdio, stdlib, etc):
int main()
{
int input;
while(1)
{
printf("\n");
printf("\n1. Add new node");
printf("\n2. Delete existing node");
printf("\n3. Print all data");
printf("\n4. Exit");
printf("Enter your option -> ");
scanf("%d", &input);
string key = "";
string ...
I have a very simple test program, running on Solaris 5.8:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char *paths;
paths = getenv("PATH");
printf("Paths: %s\n", paths);
free(paths); // this causes a bus error
return 0;
}
If I don't call free() at the end, it displays the message fine and exits. If I...
EDIT:
complete code with main is here http://codepad.org/79aLzj2H
and once again this is were the weird behavious is happening
for (i = 0; i<tab_size; i++)
{
//CORRECT OUTPUT
printf("%s\n", tableau[i].capitale);
printf("%s\n", tableau[i].pays);
printf("%s\n", tableau[i].commentaire);
//WRONG OUTPUT
//printf("%s --- %s --- %...
Hello, I wanted to write a program that test if two files are duplicates (have exactly the same content). First I test if the files have the same sizes, and if they have i start to compare their contents.
My first idea, was to "split" the files into fixed size blocks, then start a thread for every block, fseek to startup character of ev...
#include<stdio.h>
/* this is a lexer which recognizes constants , variables ,symbols, identifiers , functions , comments and also header files . It stores the lexemes in 3 different files . One file contains all the headers and the comments . Another file will contain all the variables , another will contain all the symbols. */
int mai...
char
char* c[30];
c = (char*) malloc(30*sizeof(char) );
How does this give an incompatible declaration in built in function warning and and incompatible types in assignment error in the line where i have declared malloc . According to the syntax of malloc , i shouldnt have any error
...
My OS is Debian, my default locale is UTF-8 and my compiler is gcc. By default CHAR_BIT in limits.h is 8 which is ok for ASCII because in ASCII 1 char = 8 bits. But since I am using UTF-8, chars can be up to 32 bits which contradicts the CHAR_BIT default value of 8.
If I modify CHAR_BIT to 32 in limits.h to better suit UTF-8, what do I ...
Hi all,
I want to write a signal handler to catch SIGSEGV.
First , I would protect a block of memory for read or writes using
char *buffer;
char *p;
char a;
int pagesize = 4096;
" mprotect(buffer,pagesize,PROT_NONE) "
What this will do is , it will protect the memory starting from buffer till pagesize for any reads or writes.
...
My application is basically a shell which expects an input of type cmd [x], where cmd is constant and x is optional. So cmd 1 is legal as well as cmd by itself - then I assume a default parameter for x.
I am doing this:
char cmd[64];
scanf("%s", cmd);
int arg;
scanf("%d", &arg); // but this should be optional
How can I read the integ...
I am looking for a SOAP Library for C. I know there is gSOAP. What other options do I have?
...
Possible Duplicate:
Parsing text in C
Say I have written to a text file in this format:
key1/value1
key2/value2
akey/withavalue
anotherkey/withanothervalue
I have a linked list like:
struct Node
{
char *key;
char *value;
struct Node *next;
};
to hold the values. How would I read key1 and value1? I was thinkin...
Hi, I'm developing C extensions from python ad I obtain some segfaults (inevitable during the development...).
I'm searching a way to display at which line of code the segfault happens (an idea is like tracing every single line of code), how I can do that?
...