Questions tagged as 'c'

3
answers

Read a string with line break

I need to compare two strings to see if they are the same. One of them is in a struct vector and has been dealt with fgets , so it is broken. The other is informed by the keyboard. I would like to know if there is any function to read t...
asked by 07.12.2014 / 23:11
1
answer

How to pass a function pointer per parameter?

I need to be passed by argv[] , in the main function, the name of a function that will be called by it. I can not make comparisons of strings , so I should make the call with variables. Here is my code: typedef void (*func)(void);...
asked by 25.11.2014 / 03:44
1
answer

Check if field is empty, using custom read function in C

void vazio(void) { char *str = NULL, c;//apontando para null int i = 0, j = 1; //alocação de memória para str str = (char *) malloc (sizeof(char)); printf("Informe a string: "); //ler a string while (c != '\n') {...
asked by 24.01.2015 / 01:41
1
answer

Reading file in Objective C

I'm trying to read a file in .c, I can read everything right there however in the variable it returns me a whole content and a "\ n" that damages the rest of my code. Below is the section that reads the txt for you to analyze. char * info_cont...
asked by 19.09.2014 / 00:37
2
answers

How to put images on the screen?

In MSX, you used BASIC to place an image on the screen without leaving command line mode. Today, we can not do this anymore? Without using OpenGL or other APIs, how do I put pixels on the screen? Or a whole picture? Do you have to send it to VRA...
asked by 14.07.2014 / 08:32
1
answer

Vector mean, prime number indices

Well, this is the problem. I thought here and got a code. However, both the sum and the k (which would be the prime number positions) are incorrect. Any thoughts on why? #include <stdio.h> #include <windows.h> int main(void)...
asked by 09.06.2014 / 05:46
1
answer

Process Synchronization (Fork) - "segmentation fault"

I'm trying to create 3 processes and use semaphore in them. The code below compiles, but in the middle of the execution there is an error called "segmentation fault". I do not know how to solve this. Thank you for your patience. The goal is to c...
asked by 07.06.2014 / 18:36
1
answer

error in the comparison of binaries in C

I have a Perl program that connects to a socket, receives binaries on this socket, reads the received binaries, compares with other binaries in a buffer so I know if there are any binaries in the buffer received in the socket. See: perlProgr...
asked by 23.08.2014 / 22:36
2
answers

Problems inserting values into vector pointer

I'm having trouble trying to perform a programming exercise that was passed to me, where you are asked to "create a vector-type pointer variable with 20 character-type occurrences". #include <stdio.h> #include <conio.h> int main()...
asked by 27.11.2014 / 04:20
1
answer

function in graphics.h

I'm trying to learn a bit more about the libraries in C / C ++ to do more things so I went behind the graphics.h library and went after the most basic code I found, which was: #include <graphics.h> int main(){ int gdriver = DETECT, g...
asked by 28.11.2014 / 03:59