Posts by Lucas Fernandes • 578 points
17 posts
-
0
votes1
answer56
viewsQ: SIGSEGV error in using a pointer
I have the following problem: I am creating a pointer and allocating memory in it, passing its reference to function, but when I read it in the function happens the error reported in the title.…
-
4
votes1
answer3781
viewsQ: IDE for Python that has GUI modeling
I wanted to know if there is a IDE for programming in Python that provides a tool for mounting a GUI more easily, in advance that has versions for Linux and Windows.
-
5
votes1
answer438
viewsQ: How to implement timeout in recv() in socket. h
I’m wondering if there’s any function to put a timeout together with recv() using Socket.h. Code example: // Variaveis UINT in_socket_handler; struct sockaddr_in server; // Cria o Socket…
-
0
votes1
answer119
viewsQ: Doubt with use of`pthread` in Posix
I am using the following routine with library command pthread.h: // // Declaração // pthread_t threads[NUM_THREADS]; // // Criacao // for(...) { pthread_create(&threads[i], NULL, MainTH, (void…
-
7
votes2
answers2251
viewsQ: Sizeof() or strlen()?
sizeof() or strlen()? What’s the difference in their use on char hands? which is more appropriate?
-
4
votes3
answers408
viewsQ: Use free() without malloc()?
May cause some problem in using the free() on a pointer that was not allocated with malloc() beyond the necessity itself? void funcao (int par) { char *palavra; if(par%2 == 0) { palavra =…
-
0
votes1
answer40
viewsQ: `System.Nullreferenceexception` in C
Running the following code shows the error System.NullReferenceException in function call SubString #include <stdio.h> #include <stdlib.h> #include <string.h> // // Implementado o…
-
4
votes2
answers117
viewsQ: How do I use free() and return the same content?
I wanted to use the free() in ls_retorna in the following function, how could you do it with the best way? char* MemCpyX(char *as_origem, int an_inicio, int an_quantidade) { char *ls_retorno =…
-
4
votes2
answers69
viewsQ: How should these variables end correctly without having a chance of memory Leak?
What is the right way to use the free() in that case, where ls_options will contain several ls_buffer_send? char **ls_options = (char**) malloc (200*sizeof(char)); char *ls_buffer_send = (char*)…
-
0
votes1
answer397
viewsQ: error: invalid use of Undefined type 'struct Fila'
I’m implementing a queue to control the threads created, in C. So as the thread is not the first in line she waits to be finished. example: // // Enquanto não é primeira da fila // while(idd !=…
-
1
votes1
answer184
viewsQ: Build error with struct
While trying to compile I am facing the following error: ..: error: storage size of 'PPFila' isn't known ..: error: storage size of 'AUTFila' isn't known On this code line struct Fila PPFila,…
-
3
votes3
answers6206
viewsQ: How to set a Struct as NULL in C?
I’m looking to see if there’s any content on struct then wanted to initialize the variables as NULL, for if they were equal to NULL would know that they were not created. snippets: Struct: struct…
-
0
votes1
answer286
viewsQ: how to resolve "SIGSEGV" error when using`strcpy`
Hello, I am facing an error "SIGSEGV": strcpy(buffer_ReceiveAutomation, ls_buffer_PPouAUT); << ERROR and buffer is incomplete from recv, but if I change the sizeof(ls_buffer_PPouAUT) by the…
-
4
votes1
answer1504
viewsQ: error: initializer element is not Constant
I’m trying to declare this buffer overall and when compiling it presents the following error error: initializer element is not Constant char *ls_buffer_PPouAUT = malloc(5120*sizeof(char)); How can I…
-
14
votes2
answers2384
viewsQ: char[] or *char malloc?
What difference in C between char text[10] or char *char = (char *)malloc(10*sizeof(char)); What advantage of using malloc on a pointer?…
-
2
votes2
answers292
viewsQ: How to reuse a pthreads?
I’m using pthread.h and using the following functions: // // Cria A thread // thread_argsPP[contthreadsPP] = contthreadsPP; pthread_create(&threadsPP[contthreadsPP], NULL, ReceivePinPad, (void…
-
2
votes1
answer46
viewsQ: "SIGSEGV" error when receiving a large data packet
Hello, I am facing a "SIGSEGV" error when receiving a large data packet with the recv function of the library using C language on a Posix - UNIX system, if any soul can help me a thank you. buffer:…