Questions tagged as 'c'

1
answer

Copying character array using memcpy

Good morning, someone could tell me the difference between static unsigned char cmd_code[2]; memcpy(&cmd_code, command+offset, 2); and static unsigned char cmd_code[2]; memcpy(cmd_code, command+offset, 2); In both cases the compile...
asked by 02.12.2016 / 18:00
2
answers

Modify const void * in C (SSL_read) [closed]

I have the following function: int SSL_read(SSL *ssl, void *buf, int num); And I would like to modify the buf (Modify the Header), I have tried several ways but the program always hangs or simply does not work. (The function is...
asked by 03.01.2017 / 18:19
1
answer

Problem in a C entry

Someone could explain or say, Why does not the code enter? If 0 comes out, it only ends. #include <stdio.h> #include <stdlib.h> #include "dibujos.h" #include <time.h> int main(){ char pal_1 [12] = "hogar";...
asked by 26.09.2016 / 23:30
1
answer

yield () in interrupt handler?

I have a struct that I have to copy; that does not present any problem, unless during the copy activates an interruption, and the handle function modify the data of that struct . In principle, there would be no problem. We pr...
asked by 16.12.2016 / 14:33
1
answer

Problem with fgetc

I have a problem and that is that fgetc does not really read what is in the file. I have the following code: int* readData(char* problem, int size) { FILE *f; //Obtenemos el fichero con el problema if ((f = fopen(problem, "r+")) =...
asked by 21.02.2018 / 19:51
1
answer

Reading of files in C

I am trying to make a program which contains the contents of a file and relates its contents to a structure because it has two fields that I want to save, the first field that contains the character and the second field that contains the code of...
asked by 26.06.2016 / 03:55
1
answer

I do not understand why the following C code does not work

I was working on c and looking at an old manual I found the following code that seemed simple. int num=50, i; for(i=1; i<=num; i++) { if( !( num % i)) //esta es la línea que saltea { printf(“%d”, i); } } My answer whe...
asked by 09.12.2018 / 20:31
1
answer

Problem with pointer and structure

Having the following code: DWORD WINAPI redirect(LPVOID param) { SOCKET rsock, csock; SOCKADDR_IN rssin, cssin; rs rs2; DWORD id; rs2 = *((rs *)param); rsock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); WSAAsyncSelect(rsock, 0, WM_USER + 1, F...
asked by 21.06.2018 / 00:02
1
answer

How to read character data within an if conditional?

My problem is that according to a whole number, for example 1, the conditional would be fulfilled and therefore, I would have to read the data I am requesting, of a character type. When performing this action, at the time of entering the number...
asked by 13.06.2018 / 08:39
1
answer

Hangman game in C

I'm doing a game of Hangman in C and until now I have the count of the letters depending on the word to guess that the user enters, I already have a condition that tells me that if the letter that you enter is equal to any of the positions of th...
asked by 15.08.2018 / 02:48