Questions tagged as 'c'

1
answer

Why does this seemingly simple implementation of strupr not work?

Error implementation in GCC: char* strupr( char *str ) { while(*str) { *str++ = toupper(*str); } } Note that str is used twice in assignment .     
asked by 02.04.2016 / 14:06
2
answers

Problem in C when reading file and writing to vectors / arrays

I'm having trouble reading data from a file and writing it to a vector and array. I can not give printf to test them. So I'm not sure if the code is correct. The file has student names and their enrollments respectively. #include stdio....
asked by 04.11.2014 / 15:21
1
answer

Stock and Sales Control

Hello, this program is a stock control, which it asks for in the first% program%, an inventory and sale controller with struct. Cases 3 and 4 are in trouble because I do not know how to get the information from the registered items. Case 2 also...
asked by 03.09.2014 / 06:15
2
answers

How to include "time" library in the compiler?

I'm compiling in C on my Mac through the terminal, this is all a wonder, the only problem is that when I need to call a new library I do not know which command to call it by the terminal. Ex: #include <stdio.h> is -std=c99...
asked by 26.09.2015 / 23:31
1
answer

Using Unicode in a variable char

How do I use unicode in C ? I just do not know how to store the 2 bytes of a unicode in a char, only this, does anyone know how?     
asked by 28.10.2015 / 03:57
2
answers

How to pass a .sh file as a parameter to a code in C?

I need to pass as a parameter to a program in C a file with .sh extension. I already tried it and the value that is read from the file is wrong: ./program ./file.sh How do I get past this argument? Do I need to add anything to make? Thank you...
asked by 27.10.2015 / 12:05
2
answers

Triangular number

I would like to know why, when I type in the program below, it checks if the number entered is triangular, that is, it is a multiple of three consecutive numbers, for example 60 it prints two "NO" and one "YES", and when I type 336 do five "NAO"...
asked by 19.04.2015 / 19:48
1
answer

Segmentation Fault and Error in typedef struct

Hello, I'm developing a final work on a course and I'm getting two errors that I do not understand. First here's the code. #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { FILE *mestre, *indice; int opcao,...
asked by 24.06.2014 / 17:56
2
answers

Deleting extra characters using scanf

Hello, friends! I am creating a program that reads data separated by semicolons, checks them and returns a list with possible errors. (example: the user enters CNPJ, social name, UF as follows: 12345678901234; company x; SP). I'm doing this b...
asked by 24.06.2014 / 02:31
1
answer

How to develop a basic game using opengl that accepts keyboard commands [closed]

I tried to follow the source of a tutorial Metar Gearn Nanna because it was interesting to create a game in opengl and c ++, could be something simple, with precarious validations, just so I can understand the concept, I learned to draw triang...
asked by 01.07.2014 / 21:55