Posts by Brumazzi DB • 4,345 points
175 posts
-
1
votes3
answers40
viewsA: How to turn a 2D Array into 2D Pointer in C
In C an array is read as a vector, and when you try to use a double pointer, it ends up searching for a memory address that is not allocated to its vector. int matriz[2][2] = {{1,4},{3,7}} /* é o…
-
4
votes0
answers36
viewsQ: What is "L" for before a string in C++?
I noticed that some frameworks and Engines require the string to be passed with L before the text. A Irrlicht Engine is an example. myObject->setLabel(L"my string"); What is the purpose of this L…
-
1
votes1
answer56
viewsQ: What is the purpose of the symbol "&" in the declaration of an object?
I noticed that some statements of variables/objects are used * for the statement (thus generating a pointer), but in some cases has the statement using &. const MyClass & my_class =…
-
0
votes1
answer31
viewsQ: Jquery replaceWith deletes element when exchanging in several places
I’m having a problem with the function call replaceWith of Jquery. I have a variable that is storing an HTML structure, this structure I want to render in several different places (this works when I…
-
3
votes1
answer90
viewsQ: Merge different database queries
"It is possible to join information from tables of other databases?" This doubt arose when I needed to do a survey make a comparison of data in tables of different stores, Every store has its own…
-
2
votes1
answer90
viewsA: Merge different database queries
It is certainly possible to do a search in different databases at the same time. to access different databases just pass inside select the database, table and fields you want to take. SELECT…
-
0
votes1
answer22
viewsA: Error of procedure call
I found the Error. I wasn’t saving the changes because you don’t hear the confirmation using the db.commit() before finalizing the database connection.
-
0
votes1
answer22
viewsQ: Error of procedure call
I’m having a problem calling one procedure within a function in the SQL. When I call the function CHECK_LOGIN for SGBD, does the operation without any problem, but I need to do this operation by a…
-
0
votes2
answers520
viewsA: What are gch files and how do they work?
Files with extension .h.gch are pre-compiled header files by GCC, they serve to import the headers as a file .h. When importing a library into C/C++ (as my_math. h) could use a pre-compiled file…
gccanswered Brumazzi DB 4,345 -
0
votes2
answers520
viewsQ: What are gch files and how do they work?
I recently came across a file with the extension .gch in one of my projects, this occurred because I ended up passing a file .h to be compiled in gcc. $ gcc -c arquivo.h $ ls arquivo.c arquivo.h…
gccasked Brumazzi DB 4,345 -
0
votes1
answer145
viewsQ: Importing local libraries into GO
I’m having a hard time importing a library from do go. The library is in a folder in the same project directory and always of the import error, when not of the import error, of the error to access…
-
1
votes2
answers385
viewsA: Problem with C matrices
In C as the for should never begin in 1 and go up to N when working with vectors and matrices, because the size of the vector or matrix goes from 0 until N-1. If you have a 6x5 matrix, I am for i…
-
1
votes1
answer26
viewsA: renaming file with Posix c
Your error is because of the input variables. char *oldname; char *newname; They are pointers and do not have a size allocated to them, to repair their code declare the variables oldname and newname…
-
0
votes1
answer131
viewsA: What error? Strtok C
When you make the declaration of your array to receive the number, char str[4], array[3];, you set a very small space to store 3 numbers separated by space. When you make the entrance 1 2 3 is…
-
1
votes1
answer763
viewsA: Warnings when compiling the program
First in your main you created the variables x and y, but did not initiate any value in them. And in function ImprimePonto the same thing with the variable nponto. main: int main(){ /*...*/ int…
-
0
votes2
answers83
viewsA: Problems with struct reading in function
Your code has many syntax errors. first to import the stdio.h, must have the characters < and > to define the library that is importing: include <stdio.h>. Its function ler_dados has a…
canswered Brumazzi DB 4,345 -
1
votes3
answers83
viewsA: How can I display only the package names while being unpacked
In Shellscript there are native instructions for handling the String, removes a string from the end of String is one of them, and for that we use the instruction %. Your use must be inside the key…
-
0
votes2
answers1435
viewsA: C - Print the N-esimo prime number
First is to clear the values of the check variables, and knowing that the prime number is only divided by 1 and for himself, must stipulate the limit of divisions that he can make. To catch the nth…
canswered Brumazzi DB 4,345 -
7
votes1
answer7588
viewsA: What is an unary operator
Unary operators is an "instruction" composed of two symbols, which need not necessarily be between two terms (variables, etc). When referring to the unary operator, the interpreter refers to its…
-
2
votes1
answer532
viewsQ: What is Ansi Escape Code?
For handling of the linux terminal (other OS console also), is using a string started with a hexadecimal value 0x1B known as ANSI Escape Code. For example printf("\x1B[32mMy Text\n"). How does the…
-
1
votes1
answer532
viewsA: What is Ansi Escape Code?
ANSI Escape Code There is a pattern made based on a standard ANSI to control outputs made in a text terminal. The manipulation of these outputs is done by commands called ANSI Escape Codes, that are…
-
2
votes3
answers972
viewsQ: How to get the buffer from the socket?
I am receiving a lot of data coming from a server, the client(the code below), after sending a message, it receives another, but I would like to know the size of the message that is coming from the…
-
1
votes1
answer51
viewsQ: Error collecting dynamic typing value
I’m having trouble collecting the values in a dynamic C typing. The inserted values as char, const char *, int, void * and long int work perfectly when placed in the printf (prints the value without…
-
6
votes1
answer4695
viewsQ: How to identify the type of variable in C?
In languages such as Nodejs, Ruby, Moon, etc. When I want to know what the type of my variable is just use the function typeof (not necessarily in the cited languages) that returns a String with the…
-
5
votes1
answer4695
viewsA: How to identify the type of variable in C?
The language C, does not have a macro capable of doing this, but from the gcc5 has the implementation of _Generic, that is able to issue a return from a variable type of. #define typeof(var)…
-
3
votes1
answer179
viewsQ: Return of functions in C
A very common and practical thing in interpreted languages is the return of functions from another function. But in compiled languages as well as C, it is possible to return a function?…
-
4
votes1
answer179
viewsA: Return of functions in C
Yes, it is possible to return functions in C equal as in interpreted languages. In Moon, can declare the function you want to return, already at the function return. Ex: function return_func()…
-
1
votes3
answers871
viewsQ: Polymorphism in C
It is possible to use Polymorphism in a structured language such as C? Languages such as c++,Java,etc(Object-oriented languages), have structures capable of inheriting functionalities for code reuse…
-
4
votes1
answer2044
viewsQ: Creating processes with Fork
I am creating a sequence of processes through the command fork, but when I went to list the processes generated by the code, I found that there was a greater amount than I had created. Because of…
-
0
votes1
answer63
viewsA: Does anyone know why there’s a glitch in this program?
Its first structure is, does not start or stays in an infinite loop. for(x=contador_pilotos-1;x<=1;x--) You can see that contador_piloto can be any value, > 1 or < 0. So: When…
-
0
votes3
answers6852
viewsA: language c is giving me a small error and I can not correct
Your entire code is in error: int i; cat[i].nome = nome_da_categoria;. The variable i has junk, so its value can be -36, 986, etc. This causes memory errors in its array. Always start a value for i.…
canswered Brumazzi DB 4,345 -
4
votes2
answers159
viewsA: I can’t keep the string
The scanf has a format for reading characters, so it reads everything typed up to a specific value. scanf("%[^\n]", var); // irá ler tudo que estiver antes do \n (quebra de linha) As his String has…
-
0
votes2
answers73
viewsA: How to make a database search appear in a table?
To facilitate you can put one for within the while: <table> <?php while($linha= mysql_fetch_row($selecaodedados)){ echo "<tr>"; for($x=0; $x<count($linha); $x++) echo…
-
3
votes2
answers5722
viewsA: What is the difference between Wait() and Sleep()?
The wait, expects to finish the child process in order to continue the execution of the system. Already the sleep, causes the Thread sleep for a certain time before it resumes execution (if you…
-
0
votes2
answers949
viewsA: How can I use Pip in a python version installed by pyenv?
The pip as well as language Python is very specific with versions. When to start the terminal Python we have: python python2 python2.6 python2.7 python3 python3.4 python3.5 ... With the pip is the…
-
1
votes2
answers241
viewsA: How to switch the #(fence) symbol by the $(dollar sign) in the terminal after switching user
The archive /etc/profile usually has a variable called PS1 (you can find it by typing echo $PS1), it has the function of creating a mask for the input of the Bash, changing its value, changes the…
-
3
votes2
answers1478
viewsA: How to verify the existence of a folder?
The best way to do that is by using the opendir, this function works equal to fopen, if you do not find the desired "item" returns NULL. #include <sys/types.h> #include <sys/stat.h>…
-
5
votes1
answer1182
viewsQ: Static functions in C
I noticed that some libraries use functions and static variables, for example static int sum(lua_State *state). This function belongs to a library that will be compiled into the language Moon. But…
-
3
votes1
answer431
viewsA: What is the meaning of the symbol ":" and "?
As well as several programming languages, when writing a String, and there are strings that return a value like: "\a" --> Sinal sonoro "\n" --> Quebra de linha "\t" --> Tabulação horizontal…
shell-scriptanswered Brumazzi DB 4,345 -
3
votes2
answers1127
viewsA: How do I access the values of a struct?
Your problem is in main, when you declare your vector struct armazenar p[MAX] a sequence of values is created. 0 1 2 3 4 N __________________________________________________…
-
2
votes1
answer631
viewsA: List of structs
The way it’s implemented, it’s not the right way, following the database hierarchy: |-------------| |--------| | Funcionário |------1-N-----| Pessoa | |-------------| |--------| The implementation…
-
0
votes2
answers37
viewsA: Problem deleting from recursion list
Usually only makes the method call inside himself when working with Graphs. As you are using a list, just move on to the next element. lista *rem; while(l){ rem = l; l = l->prox; free(rem) } This…
-
2
votes1
answer241
viewsA: How to catch the line below (next line) in C?
If I understand correctly, you want to take the last value of the third line, well, to make the comparison of the initial text, you can use the memcmp, it makes a comparison of bytes similar to the…
-
3
votes1
answer2016
viewsA: How to make an appointment in C language?
If you want to fetch data on for a query within a file, I recommend using fwrite and the fread, because it will write the exact bytes to your structure, thus facilitating your search. Entering data:…
-
1
votes2
answers5472
viewsA: calling a function within another function in c
The archives .h serve only for referencing methods, structures and values, creating a method within a header file can cause serious problems in the future. The correct would be to have another file…
-
1
votes3
answers2365
viewsA: How to receive C input data until no more input?
You can set a point to end the reading, in case the end is the line break ENTER. #include <stdio.h> int main(int argc, char **argv){ char c = 0; int sum = 0; int n; while(c != '\n'){…
canswered Brumazzi DB 4,345 -
0
votes1
answer75
viewsQ: Pointer error with dynamic library calling
I’m wanting a method within a dynamic library to read the value from within a pointer using dlfcn.h. But it always has memory error when I try to access the value inside the pointer. main. c…
casked Brumazzi DB 4,345 -
1
votes1
answer726
viewsQ: Difference between recv and read, send and write
I am transmitting and collecting data from a connection using Sockets, to send the data to the server, you can use the commands send and write, and to receive the data recv and read. There is a…
-
1
votes1
answer247
viewsA: When I try to make a.bin file it gives multiple definition error in all functions
First of all, your file aluno.h, for being a header file, it is good practice to use macros to prevent the file from being imported multiple times to the project. #ifndef ARQUIVO_H #define ARQUIVO_H…
-
0
votes2
answers5595
viewsA: How do I validate input in c?
When you try to add a value String in a Integer, will give memory error(Normally). But if you read a String this is possible. Instead of using scanf("%i") and use scanf("%s"), can use the method…