Quantcast
Browsing all 40 articles
Browse latest View live

Comment by Zan Lynx on How Do You Programmatically Set the Hardware Clock on...

@Offler This answer was not meant as a copy and paste ready to use solution. I included the struct to show how it worked. For a real example view the source code to the hwclock program.

View Article


Comment by Zan Lynx on How can I solve race condition for Golang WAF service?

In case you haven't found it yet, look for the Go race detector. Very handy. I believe it is the -race flag when building.

View Article


Comment by Zan Lynx on GCC issues a warning that my precompiled headers...

Macro definitions must be IDENTICAL. So defining your PCH define is not going to work. And it looks like your rule to produce the gch file is producing assembler output. That won't work, ever. And I...

View Article

Comment by Zan Lynx on Why this code gives run time error on mid calculation?

A tip for code formatting. Copy it from your IDE or text editor and paste it into Stack Overflow. Then select all the code and click the format button for "Code" which will add the four spaces in front...

View Article

Comment by Zan Lynx on How to create a collection of member variables at...

@jhnlmn You already have a thing that collects mutable variables of different types with descriptive names. It is a struct. It's called a struct.

View Article


Comment by Zan Lynx on Using read() for reading a file in C

@GratefullyDead "the snippet here that really matters" No. If you do not understand what is going on, and you obviously don't, then you don't know what really matters. Sometimes the particular header...

View Article

Comment by Zan Lynx on Why do I need a C++ redistributable for a specific IDE?

Oh yeah you may also look into using support.microsoft.com/en-us/topic/… aka the Universal C Runtime.

View Article

Comment by Zan Lynx on Why do I need a C++ redistributable for a specific IDE?

@Joe If you pick Visual Studio 17's C++ compiler then you need the DLL for 17. Otherwise it won't have support for the updated versions of C++ std::string and other things. I also tried to show how you...

View Article


Comment by Zan Lynx on Function signature for potentially failed unique_ptr...

@МоргуновВладислав: Only if I change the parameter to remove the &&. Then it works. Updating.

View Article


Comment by Zan Lynx on How to use sched_yield() properly?

On Linux sched_yield with SCHED_OTHER (ie normal processes) is not a good thing to use. It puts the thread at the very end of all process and thread priorities. Not just the threads in the process....

View Article

Comment by Zan Lynx on C++ pthread hand over object to thread

Ever since C++11 which is now ten years old, there has been no reason to use pthreads directly in C++.

View Article

Answer by Zan Lynx for How to access map values in golang

That is a rather strange format and looks like it is expecting a PHP script. Or some other scripting language.The ParseQuery function has made a map but the key is a string that looks like...

View Article

Answer by Zan Lynx for C++ expected unqualified id

I believe the error is caused because you didn't #include <string>.But there are other problems too. It sort of looks like you meant to create a send function but the semicolon ; is causing it to...

View Article


Answer by Zan Lynx for Dropping C library on Linux w/GCC

Here is what I got:#include <sys/syscall.h>// Copied from MUSL libc// There are more at// http://git.musl-libc.org/cgit/musl/tree/arch/x86_64/syscall_arch.hstatic __inline long __syscall1(long n,...

View Article

Answer by Zan Lynx for Why this simple C program uses has different cpu usage...

There are a couple of things that can cause this.First, programs that monitor CPU usage report in different ways. Windows Task Manager reports 50% for one entire CPU core at maximum use. Apple's...

View Article


Answer by Zan Lynx for Is the memory allocation done by malloc always...

A single block of memory returned by malloc, calloc or realloc will always be contiguous.The next block of memory returned by a separate alloc call can be at any address and does not need to be...

View Article

Answer by Zan Lynx for Is there a C++ function to suspend of resume a child...

You said Powershell in the tags so I assume Windows.If you have a handle to a process then you can do things to that process. The list of things you can do is documented in MSDN. In this case you would...

View Article


Answer by Zan Lynx for How to cout int like a double

You are supposed to do it with the locale library.Mostly copied from https://en.cppreference.com/w/cpp/io/manip/put_money like so:#include <iomanip>#include <iostream>#include...

View Article

Answer by Zan Lynx for at job scheduler doesn't work on my Ubuntu

PyCharm and other GUI programs need a lot of information from your environment. The atd daemon which runs jobs for at does not have access to this environment. You will need to specify it directly.I...

View Article

Answer by Zan Lynx for How Do I run a certain .cpp file in Visual studio?

If you want to run certain functions in order to see if they're working properly, that is a good thing and is called Unit Testing.You want to look into the C++ unit testing features of Visual...

View Article
Browsing all 40 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>