Posts by Luiz Fernando • 345 points
12 posts
-
-1
votes1
answer27
viewsA: How to clear a string for the previous value after using strcat()?
I managed to find the following solution to work as I wanted: char *discord_api_mutable = NULL; const char *get_route(const char *route) { static const char *discord_api_url =…
-
-1
votes1
answer27
viewsQ: How to clear a string for the previous value after using strcat()?
I’m using the function strcat() to concatenate string and I’m having trouble returning the string to the previous state, what I’ve tried so far is this, but with nothing successful: const char…
-
3
votes1
answer58
viewsQ: Is it recommended to use typedef in C++?
I know C++ is compatible with C, but C++ has its own way of programming and C as well, so there are legacy things from C that shouldn’t be used in C++, the typedef is one of them? If yes, what to…
-
0
votes0
answers23
viewsQ: Use char[] or char* to initialize a string?
It would be more correct to use like this: char[] nome = "Fulano"; Or so: char* nome = "Fulano"; I’ve even seen cases of starting a string like this: char nome[256]; strcpy(&nome, "Fulano"); Or…
-
7
votes1
answer72
viewsQ: Use the anonymous typedef or not?
I was looking at some C codes and I came across something like this: Example: typedef struct { char nome[256]; } Pessoa; typedef struct Pessoa { char nome[256]; } Pessoa; There is some difference…
-
-1
votes1
answer37
viewsQ: How to load a JS script when the page is not cached?
I’m developing an extension (just for me for now) for Microsoft Edge Chromium that changes the Github source, but it doesn’t change when I reset the page cache, here’s the script I made (it’s just…
-
0
votes2
answers44
viewsA: Download Async Task C#
I believe the mistake is because you’re forgetting to import some library from C#, as you’re saying in: você está se esquecendo de usar uma diretiva ou uma referência de assembly?, if you are using…
c#answered Luiz Fernando 345 -
6
votes1
answer79
viewsQ: What is the difference between the function "malloc()" and a created variable?
I was reading some codes in C and I realized that to generate some specific object is used the function malloc(). It is not easier to create this object in a variable than to use the malloc()? Here…
-
4
votes1
answer41
viewsQ: How to convert regex Pattern from C# to C++?
I’m trying to use C++ regex but I’m having some difficulties, one of them is that Pattern was in a C#code, and I know practically nothing of regex in C++, and so the code does not work as it should…
c++asked Luiz Fernando 345 -
1
votes2
answers77
viewsQ: When to use constexpr in C++?
See you around the keyword constexpr (mainly in ifs and constants) many times, I have read the Microsoft documentation and searched on the internet and still did not understand much the function of…
-
1
votes1
answer35
viewsQ: Why should one use extern in a variable declared in a header file?
I was searching in the background about C++ header files after I often got the error LNK2005 in the compilation of Visual Studio, and I realized that the error was that I was declaring a variable…
c++asked Luiz Fernando 345 -
-3
votes1
answer80
viewsQ: Coding conventions in C++
Hello, I’m learning C++, and I’m looking for best practices for creating variables, functions, classes and so on. I’ve researched the subject on the Internet, but I couldn’t find anything to talk…
c++asked Luiz Fernando 345