Posts by MiguelTeixeira • 60 points
10 posts
-
1
votes2
answers1854
viewsA: Capture Computer and User name
Complementing the above answer, getenv() returns: "One C String with the value of the requested environment variable, or "A null pointer if such an environment variable does not exist." The linux…
c++answered MiguelTeixeira 60 -
0
votes1
answer58
viewsQ: Something like Getasynckeystate() for Linux systems, is there something similar?
I did a lot of research on the internet and couldn’t find something like Getasynckeystate() that isn’t in the windows.h library. Is there any library or path to follow that allows "direct" control…
-
1
votes1
answer502
viewsQ: Create/manipulate file within a directory other than main.cpp
This works, creates a file and puts what I want inside it: #include <fstream> #include <vector> using namespace std; int main() { ofstream arquivo; arquivo.open("arquivo.txt");…
c++asked MiguelTeixeira 60 -
1
votes1
answer57
viewsA: Wrong output in C
Greetings! The problem is in the following code snippet: float passageiros[numeroDePessoas][5]; When you declare an Array of size 5, you should think that the count starts from 0. That is, you have…
-
0
votes1
answer72
viewsQ: How to assign split lines(Strings) of a vector to an element of another vector. Ex: v[lineAntiga][elementLinhaAntiga]
#include <iostream> #include <vector> #include <string> /*Função para fazer split*/ std::vector<std::string> split(std::string s, char c) { std::string buff{""};…
-
0
votes3
answers95
viewsA: Identify a specific word in a C++ String, is there a function ready for that? Or just in the nail itself?
The answers were great, maybe I redo my code. I ended up finishing it on the nail. But I liked knowing that I can "automate" this. I solved it this way: #ifndef PACOTE_H #define PACOTE_H #include…
-
0
votes3
answers95
viewsQ: Identify a specific word in a C++ String, is there a function ready for that? Or just in the nail itself?
Hello, I’m getting a series of strings(lines) from a . txt file and putting them into a vector. But there’s a problem, strings come with an unwanted start, example: Depende: lsb-release Depende:…
-
0
votes1
answer81
viewsQ: My Shell script does not work "word Unexpected (expecting "in")"
I have no experience with Shell Script, and I can’t figure out what the problem is with my code. #!/bin/bash echo 'Deseja alterar a data e a hora deste computador (S/N) ?' read dataHoras if…
-
0
votes2
answers1476
viewsQ: Print components of an array in reverse order
I wrote a code to print the components of a array in reverse order. However, it only returns 5 or 6 numbers (at most), even if I have put more numbers in it. #include <iostream> using…
-
0
votes2
answers1368
viewsQ: Error: "cannot Convert 'int*' to 'int**"
I am trying to send the address of an array to a created function (which has as parameter a pointer that is also an array). The error is as follows: main.cpp: In function 'int main()':…
c++asked MiguelTeixeira 60