I’m trying to compile a c code under linux using gcc-4.9 (tried also 5.4) while so, I faced a segmentation fault error. this is the part of code where the problem exists: automorf is an array n x n long (int automorf[n][n]) Can you please help correcting the problem? Answer Try this and see output we have not p3[3]; and
Tag: c++
How can I measure CPU time of a specific set of threads?
I run C++ program in Linux. There are several threads pool (for computation, for io, for … such things). The system call clock() gives me a way to measure the CPU time spent by all the CPU cores for the process. However, I want to measure the CPU time spent only by the threads in the computation threads pool. How
pthread_self() doesn’t return a meaningful thread id?
I was running this program on RHEL 5 with gcc4.1.2. Seems the syscall can give the correct thread id(same like process id), but pthread_self doesn’t give meaningful result. Is it because pthread_self is not portable? Answer If you read man pthread_self, which you should: Thread identifiers should be considered opaque: any attempt to use a thread ID other than in
Bypassing SSL Certificate Validation on DotNet Core Service Stack
I know that ServicePointManager.ServerCertificateValidationCallback no longer exists in .Net Core and is instead replaced with: However we are currently using the ServiceStack.Core library which, as far as I can see, does not expose either a property like this or the handler itself. How would I tell a ServiceStack client to bypass ssl validation in this code? If there is a
Get hardware information from /proc filesytem in Linux
I use execv to run lshw command to get the CPU, disk, and memory in C code. But I would like to search another solution to get these information from /proc or any other existed data. Have any suggestion? Here is my code: Linux command: $ sudo lshw -short -c disk -c processor -c memory I have two questions: Where
Reading a string, char[] until end of line C
I need to read a file name, but I want my code working for names contains space. How to read until end of line from keyboard? My code: Answer Read carefully the documentation of fgets(3) (which might be locally available on your Linux computer with man fgets) fgets() reads in at most one less than size characters from stream and
How to check if process is running on Red Hat Linux?
I’ve been using a modified class I found to check if another instance of the same process is already running, the problem is that the method of checking for the process adds another instance of the same process. When my application starts, a new process ID is created and is visible with: With this I get a since entry returned,
Can I be sure that a UDP recv executed immediately after a successfull call to recv with MSG_PEEK will not block?
Assume the following code (for the sake of simplicity I’ve omitted the necessary error handling here): In that case: Can I be sure that after the first call to recv the whole datagram is already received and therefore the second call to to recv will not block? Or can it happen that if IP splits the datagram, the first recv
implement a read operation list in debugfs
i’m implementing a kernel module. using several techniques. 1 of them is to give read/write to different module variables. i was able to read/write all variables except the list i have in my module. the linked list: i would like to have a corresponding file in debugfs that will print the full list. i tried all the ‘simple’ read functions
MonoDevelop Error: Unknown MSBuild failure. Please try building the project again
Just installed MonoDevelop and I tried to compile a simple “Hello World”. Code I used: The error that I get is : My system info: Ubuntu 16.04 LTS , updated The MonoDevelop and mono are freshly installed. Mono JIT compiler version 5.0.1.1 MonoDevelop Version 5.10 I can use mcs and run it but can’t use monodevelop to run it. I