Questions tagged as 'c'

1
answer

Corrupt text file

Good afternoon, I'm doing a practice for the university, the program consists of the creation of a loop in which a child process, created by fork () sends a pid to the father through a pipe and then dies, The parent then enters the pid and a lin...
asked by 18.01.2017 / 19:21
1
answer

In operations on an array, it shows an incorrect result after the first row of the array

Why when calling the functions that multiply and divide each of the elements of the rows of an array, it only shows me the first multiplication of the first row of the array, and the other results show them as equal to zero? #include <stdio...
asked by 21.12.2016 / 03:33
1
answer

Get shell variable from C

This is the code I was testing, but for some reason the output I get is nothing. #include <stdio.h> #include <stdlib.h> int main (int argc,char*argv[], char *envp[]){ FILE *fp; char path[1035]; fp=popen("/bin/echo ${CO...
asked by 28.04.2017 / 19:31
1
answer

Problems with C libraries

I have this library to perform different validations in my project #ifndef VALIDACION_H #define VALIDACION_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ncurses.h> #include <ctype.h> #inc...
asked by 01.12.2016 / 21:07
1
answer

One variable, two different results.

One question, why when I print the variable 'Age' does the result come out first well, and then multiplied by 10? Code: int main () { int Beca, Edad; float Prom; char edad[2], beca; int valid; do {...
asked by 02.08.2017 / 23:51
1
answer

How do I create a matrix in C with more than 294 elements, since it falls and gives: RUN FAILED (exit value 1, total time: 469ms) in NeatBeans

#include <stdio.h> #include <stdlib.h> #include <windows.h> double performancecounter_diff(LARGE_INTEGER *a, LARGE_INTEGER *b){ LARGE_INTEGER freq; QueryPerformanceFrequency(&freq); return (double)(a->QuadPart - b->Qu...
asked by 07.04.2017 / 05:50
1
answer

How to solve the segmentation fault (core dumped) error when strtok is printed?

I have been investigating about this error that appears to me when I try to compile the following lines for example: char cadena[] = "hola mundo"; char * div = " "; char * token = strtok(cadena, div); while (token != NULL){ printf("%s\n",...
asked by 31.07.2016 / 00:06
1
answer

Random characters at the end of string

I have done two functions of simple encryption of strings in C. It seems to be fine but when it comes to displaying the result, 2 random characters are added to the end of the resulting string. The function what it does is create a new string...
asked by 18.10.2016 / 00:33
1
answer

Basic C matrix

I've written this code for an array, everything is fine when compiling, but when I'm going to type the 3rd value it closes. #include <stdio.h> int main (){ int mat[5][6]; for (int i=0 ; i<5; i++){ for (int f=0; f<...
asked by 10.07.2017 / 17:00
2
answers

Read content from a binary file, which contains integers?

as you can read the contents of a file ".bin" in which we have inserted whole numbers. I would like to know how you can read that file, I used the "fread" tool but it does not show me anything or random numbers. The ".bin" file contains th...
asked by 31.05.2016 / 00:53