Posts by zentrunix • 5,511 points
272 posts
-
0
votes3
answers225
viewsA: Update Python on LE 4.0 (Ubuntu 10)
What is "LE 4.0" ? The module name is Simplehttpserver (note the upper case) and it does exist in Python 2.6.5.…
-
2
votes2
answers564
viewsA: How to equate a vector coming from a matrix with a matrix in the main function?
What you want to do is assign the array retorno which has been filled by the function retira_espaco to another array, but this is unnecessary, because arrays are passed by "reference" when they are…
-
0
votes2
answers1128
viewsA: free(): invalid next size (fast) while trying to free up memory
#include <stdio.h> #include <stdlib.h> typedef struct { int capacityOfElements; //capacidade do vetor int numberOfElements; //número de elementos presentes no…
-
8
votes4
answers3125
viewsA: Precise math division
If you at all times whether exact numerical results, this is intrinsically impossible to achieve using computers or not. For example, what is the "exact" result of the square root of 2 ? The result…
-
1
votes1
answer260
viewsA: How to read file . cap with C?
You have to process the . cap file according to its layout, which is documented, for example, here: https://wiki.wireshark.org/Development/LibpcapFileFormat Unless you really need to write a program…
-
0
votes1
answer64
viewsA: At the end of String’s printing always leaves the 0p. What is it?
You have to test whether vetor[i] is different from binary zero because fgets always puts a binary zero at the end of the typed field. Otherwise the loop follows until the end of vetor, and may…
-
2
votes2
answers292
viewsA: How do I compare an input in char with an interval (0 to 9) without specifying individual conditions?
#include <stdio.h> // para printf, fgets #include <string.h> // para strchr int main() // tipo de 'main' e' 'int' { // variavel de controle do 'for' que anda no…
-
1
votes4
answers1794
viewsA: Node replaces Nginx? Can someone explain this architecture to me?
To sum up: Node.js is a software development platform focused primarily on the internet, and preferably on the web (http protocol). Nginx is an http server. The two products (are software products)…
-
0
votes2
answers1192
viewsA: Maximum value for srand((unsigned)time(NULL);
The numbers generated by rand() sane pseudo-random, non-random (after all, they are generated by an algorithm, not have to be random). Now, this number 32767 is suspicious, as it is the largest…
-
7
votes2
answers12195
viewsA: Difference between Std::Cout and Cout?
In C++ all names defined in global scope belong to a namespace. A name is in the global scope when it is declared outside a function and a class. For example #include <iostream> int a = 1; int…
-
2
votes1
answer79
viewsA: LNK2001 error in C++ Project Build
Some implementation files are missing, apparently from the Cpsock::Listensocket class, and from Tmsrv, which may be an external variable or a function. Either files are missing from the compilation,…
-
3
votes1
answer3401
viewsA: Convert hexadecimal string to C-readable output
Using your example. Now putting the complete program, tested on ideone. #include <stdio.h> #include <string.h> //strlen int main() { // para loop "for" int i; // area de entrada char…
-
2
votes1
answer86
viewsA: How to split a string sprintf into multiple lines in C?
In C counting and adjacent strings are concatenated. So you can naturally split your string into several parts, each part into a row, but each part needs to have its own quotes. Thus: "GET %s…
-
1
votes3
answers6535
viewsA: Sequence reading of space-separated numbers
Read only one number at a time. The result of scanf will then be 1 if reading was successful, or zero if failed, and in this case the line was read completely. For each number read, allocate space…
-
1
votes1
answer413
viewsA: Sending and Receiving Packages (packets) in Nodejs
The basic class of Node.js used for TCP communication is called "net". Below is an example of server and client made with the "net" class. The original (with comments) is in…
-
1
votes1
answer3668
viewsA: How do I use fgets instead of gets?
The fgets function puts ' n' at the end of the read string. So, in this case, the "name" content will be "0 n", not just "0". http://linux.die.net/man/3/fgets…
-
-2
votes1
answer337
views -
0
votes3
answers8991
viewsA: What language is used to program an operating system?
Currently "production" operating systems are written in C.
-
1
votes3
answers1915
viewsA: What are [ ] bash for?
This is a condition test. For example: if [ -e arq.txt ]; then echo Arquivo existe else echo Arquivo nao existe fi will display the message "File exists" or the message "File does not exist",…
-
1
votes4
answers4551
viewsA: Recursive multiplication in C
A recursive algorithm always assumes the use of the same algorithm in a simpler problem, until eventually the problem is so simple that it is no longer necessary to use recursiveness. In your…
-
1
votes1
answer504
viewsA: insert bash commands into expect
You can pass arguments in the script call. Example copied from Stackoverflow. https://stackoverflow.com/questions/17059682/how-to-pass-argument-in-expect-through-command-line-in-shell-script Script:…
-
11
votes1
answer479
viewsA: Socket "cutting" bytes into two packets
The standard (and necessary!) procedure when programming in sockets is to repeat the reception until the expected number of bytes has been received. How do you know the number of bytes to be…