Questions tagged as 'c'

1
answer

How to read .cap file with C?

I'm doing a small program in (C / C ++) to read some data from a .CAP file (provided by TCPDUMP). A good example would be WireShark, but I need far less INFO. It turns out, this .CAP seems to be written in HEXA and when I read the data it c...
asked by 11.09.2016 / 10:14
1
answer

Sorting in Double-chained List Circular in C

I need a little help here with Double-chained Circular List to solve a bigger problem. I need to do a function that already inserts my elements in descending order. My code even works with entries that only need to be reversed. Ex: 1 2 3 4...
asked by 02.10.2016 / 22:17
1
answer

Problem setsid function relative to ppid

**** When you run the font below regarding the creation of a deamon with the setsid function, it was verified that after the ps -fu root command, ppid is not 1, or the same as the operating system init. The source was taken from the book Program...
asked by 26.09.2016 / 03:32
0
answers

Seg fault on free (char **)

I'm developing a shell for my OS discipline. It was going well until some strange errors appeared! I can not give free(args) because I get seg fault , if I do not give this free when executing several commands sometime...
asked by 05.09.2016 / 06:51
1
answer

Parameters in the signal handler

I have a question and even after research I could not solve it. Let's say I have the following signal handler: struct sigaction conf_signal; conf_signal.sa_flags = 0; sigemptyset(&conf_signal.sa_mask); conf_signal.sa_handler = &sina...
asked by 29.09.2016 / 19:12
0
answers

How to receive an indeterminate number of variables in a C function?

I'm studying lists in c, and I have a function to remove element, Lista* retira(Lista* l, int v) , how do I get it to have an indeterminate number of variables v to remove? similar to varagars in java.     
asked by 27.09.2016 / 00:56
2
answers

What's wrong with my QuickSort C code?

Here is my code: #include <stdio.h> #include <stdlib.h> int lista[1000]; int tamanho; main () { printf("Tamanho: "); scanf("%d", & tamanho); int c; for (c = 0; c < tamanho; c++) { lista[c] = c + 1; } mistura...
asked by 28.08.2016 / 17:58
2
answers

Recursive search of files in directories

I have a function that looks for file passed by parameter in directories using language C in Linux, I am getting into the subdirectories and do the search, but when I finish the files in the subdirectory I can not go back to the previous directo...
asked by 16.09.2016 / 03:27
0
answers

Hashed vector error with offset

I'm trying to make a vector hash with offset for treatment of collisions. My program is giving a mistake. Can someone help me find the reason for the error? Follow the code: #include <stdio.h> #include <stdlib.h> #include <ti...
asked by 31.08.2016 / 16:13
1
answer

row in c doubt

having the code of the queue I need to remove value and position both chosen by the user typedef struct reg { int conteudo; struct reg *prox; } celula; // Tira um elemento da fila fi e devolve // o conteudo do elemento removido...
asked by 31.08.2016 / 18:39