Skip to content
Advertisement

Tag: c++

Segmentation fault core dumped 2d array

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

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,

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

Advertisement