Questions tagged as 'c'

2
answers

Doubt about stderr and fprintf

Hi, I have a question and I do not know how to use stderr from the stdio.h library and fprintf () of string.h . For example I have this: fprintf(stderr, "Error en planta de Centro: %d\n", numeroPlantas); Where numberPlants is a int...
asked by 16.05.2016 / 18:16
2
answers

How to delete a repeated character in C?

I am filling out a form with validations and there is a field that asks me for an average, and one of the rules to validate it is that it only contains one decimal point. Example: If the user types 2..2, ask the average question again....
asked by 12.04.2016 / 20:23
1
answer

Save first word a file in c

I have a problem with this part of my code, I'm trying to read the lines of a file and cut only the first word of each line and then save it in an array. The question is that I read the lines well and with strtok cut the first word and send i...
asked by 16.01.2018 / 20:46
2
answers

Problem with input buffer -

I have a problem with a program in C. I want to create an array of data of type unc, previously created with struct. The program asks to enter data type string and int type. The program can be compiled but when I want to use the program the foll...
asked by 11.11.2016 / 23:18
2
answers

Read a single character in C

I was doing a menu of options and I ran into a problem. When I put "a" and press enter I go to option a but if I put "a3214" it also takes me to option a. My question is if I can avoid that and show an error message if it is not only the opti...
asked by 12.11.2016 / 16:48
1
answer

Segmentation fault in rot13 code (C)

#include <stdio.h> #include <string.h> char rot13(char palabra[]) { //char *palabra int y = (short) strlen(palabra); char abc[27]="abcdefghijklmnopqrstuvwxyz"; for (int i = 0; i < y ; ++i) { if(palabra[i]<'m'...
asked by 05.10.2018 / 23:23
2
answers

Error saving data in a struct

This is how I declare my struct, but at the time of saving it saves twice the data int semaforo; . struct mystruct { char arr[MAXBUF]; }es; struct mystruct *entrada; char g[20]={"11111111111111111118"}; So I save it and print it...
asked by 11.11.2016 / 03:12
3
answers

Different memory addresses?

I'm working on windows 10 and codeblocks, and my question is because by doing this I have the memory position for example 0060FEFC    1st Code #include <stdio.h> int main(void){ int arreglo[4]; printf("%p\n",arreglo); //Direc...
asked by 06.04.2018 / 10:14
0
answers

Uuart series communication

I have a problem receiving and sending via a serial port. The communication is made from PC to STM32 micro. From the PC I send a 0x80 and in the micro I receive 0x01, I send it a 0x81 and I receive 0xBF. If the communication is, on the contrary...
asked by 17.10.2018 / 13:38
5
answers

Add two conditions C?

What I'm trying to do is make a C program, that gives me the final grade of a subject and depending on the number, show me a message on screen. #include<stdio.h> #include<conio.h> main (){ float cal1=0, cal2=0, cal3=0, cal4=0...
asked by 31.10.2016 / 04:31