-
Segmentation fault when trying to read hidden files linux
My program reads the content of a directory specified at command line. It reads the directory recursively i.e. if we are reading contents of directory "test" and inside it we have another di -
Can someone find the mistake? Pure C realloc
I've got this code: int main() { int i=0, n=0; char sep=NULL; double **aero=(double**)malloc(sizeof(double*)); *aero=(double*)malloc(2*sizeof(double)); -
C dynamicaly changing size of array using malloc and memcpy
I wanted to write a function that changes the size of dynamic array and allows user to fill it at once. I know that I should do it with using of "realloc" (so I did and so it works...) but m -
Why won't this work ? Dynamic memory beginner program
int main() { //FILE *out = fopen("keimeno.txt", "w+"); FILE *in = fopen("keimeno.txt", "r"); int fullbufflen=0 , i; -
Most efficient way to reallocate while ordering values in memory?
I have 32 bytes of contiguous memory allocated (using malloc) to hold eight sequential 32 bit values. After certain tasks have been performed on this piece of memory, The values are laid out like t... -
Problems using malloc, structs and probably parameters
EDIT: OK, I hear you guys, I've isolated the part of my code that's giving me problems, compiled it and made sure that it still gave me the same results, here it goes: Like before, the s -
Malloc segmentation fault
Here is the piece of code in which segmentation fault occurs (the perror is not being called): job = malloc(sizeof(task_t)); if(job == NULL) perror("malloc"); T -
Create Dynamic Array of Strings in C
I know there are multiple questions about creating dynamic arrays in C but they didn't really help me so let me ask in a different way. My program needs to read in a variable number of c -
Malloc, free and segmentation fault
I don't understand why, in this code, the call to "free" cause a segmentation fault: #include <stdio.h> #include <string.h> #include < -
reallocation of a Matrix in c
Probably this is a very stupid question but I can't see through it, maybe you could help? My problem is the reallocation of a matrix, adding 1 column and 1 row to it and, then, fill the -
Set breakpoint in malloc_error_break
I'm running a piece of code that unfortunately keeps on crashing because of a segmentation fault. The console output advises me to set breakpoint in malloc_error_break to debug. I've bee -
C : malloc seems to allocate more then i'm requesting (array)
Hi I have this question: Why when I'm allocating memory with malloc for a float array, it allocate more space that i'm requesting? For example in this code i'm trying to allocat -
Realloc with matrix and automatization
I was wondering why realloc for a char* or whatever 1D array works if I do something like oldpointer=realloc(oldpointer,newsize); But when I try with a 2D char* array it fails. Lookin -
Implementing a user-level thread library but code keep seg-faulting, any ideas why?
So as the title says, my code keeps seg-faulting unfortunately. I'm pretty sure I malloc'd everything correctly and I believe that my functions are correct for the test case I have but it st -
Why does malloc not work sometimes?
I'm porting a C project from Linux to Windows. On Linux it is completely stable. On Windows, it's working well most times, but sometimes I got a segmentation fault. I'm using M -
extend matrix in C
I have a matrix in C and I want to create another one which has double rows than the first matrix.Those added rows I want to have the values of first matrix ,but with changed sign. I am trying to -
malloc causing segmentation fault by _int_malloc
I have a tree structure which I am adding a large amount of nodes too. The number of times this is done (tree cleaned between runs) and the number of nodes is given as a command line argument. For -
How can malloc() cause a SIGSEGV?
I have an odd bug in my program, it appears to me that malloc() is causing a SIGSEGV, which as far as my understanding goes does not make any sense. I am using a library called simclist for dynamic... -
Segmentation Fault (Variant of Linked List)
I am getting a segmentation fault when i init_graph then do 5 add_vertex and then has_vertex. P means it uses pointers #define SIZE (graph.size) #define PSIZE (graph->si -
sigsev error on malloc that's driving me nuts
This bit of C code is giving segmentation error in gdb if ((seq_entry_action=malloc((seq_subphases)*sizeof(int*)))==NULL){ printf("Cannot allocate memory for seq_entry_action\n& -
Segmentation fault while using malloc with char pointers
I am new to C and learning structs. I am trying to malloc a char pointer with size 30 but it is giving a segmentation fault(core dump). I searched it on the internet & SO but am not able to re -
Invalid read of size 1 Valgrind error
In my program, the function read_commands just gets 2 strings and puts it into the struct Commands and returns the filled struct. Apparently I have some fault in my logic. I'm getting the err -
Dynamic allocation of an array of structs
I've found useful answers on other people's questions countless times here on stackoverflow, but this is my first time asking a question of my own. I have a C function that dynamica -
Seemingly random segfault
I'm trying to achieve a dynamic two dimensional array in C. Whenever the program is trying to access a value in the array I'm checking whether or not the array is large enough. If i -
Why I get segfault when initializing the struct?
Searched around for one hour. I guess I'd better post the question here. I simplify the code. The segfault is in the function initMyStruct. #include "stdlib.h" & -
How to bind input value to object property in Blazor
1. Define a class with the property you want to bind:
csharp public class Person { public string Name { get; set; } }
2. In your Bl
-
Python client code gets Address already in use error
1. Change the port number: Try using a different port number that is not being used by any other process.
2. Check for running processes: Check if any other process is using
-
How can I pass the DOM event as an event handler bind method
javascript class MyComponent extends React.Component { handleClick(event) { console.log(event.target); } render() { return (
-
Get random port for socket
1. Choose a range of ports that you want to use. For example, you might choose ports 1024 to 65535.
2. Generate a random number within that range. In most programming languag
-
how to use boost::bind with std::thread (in Wt c++)
1. Include the necessary headers:
cpp #include
#include 2. Define the function that you want to execute in a
-
How can I use bind and unbind with this?
Here is an example of how to use bind and unbind to attach and detach a click event handler to a button element:
// Attach a click event handler to the button
-
Using boost function with boost bind with a map
c++ #include
#include -
bind ip to subdomain
1. Log in to your domain registrar's website and navigate to the DNS management section for the domain that you want to create a subdomain for.
2. Create an A record for the
-
How to bind and unbind click event from two different functions?
Here's an example:
// Bind click event to element with ID "myButton" $('#myButton').on('click', function() { console.log('Button clicked'); }); // Unbind cl
-
Binding INADDR_ANY:<port> and INADDR6_ANY_INIT:<port> for listening fails on Linux but succeeds on macOS
1. Permission issues: On Linux, binding to a port below 1024 requires root privileges. If the program is not running as root or does not have the necessary permissions, binding to the port
-
boost function bind compiled with a conversion error
Boost function bind is a powerful tool for creating function objects that can be used in a variety of contexts. However, it can be tricky to use correctly, and errors can occur if the argum
-
C# Excel VSTO OLE DB Parameters Error must declare scalar variable
Here's an example of how to declare parameters in an SQL query using OLE DB in C# Excel VSTO:
string query = "SELECT * FROM MyTable WHERE Column1 = @Param1 AND
-
C# Mysql populate list<T>
1. First, create a class that represents the data you want to retrieve from the database. For example:
public class Person { public int Id { get; set; }
-
When using bind() to pass an argument to event handler in React component, what is the argument and "this" referring to within the event handler?
The "this" keyword within the event handler refers to the component instance that the event handler is bound to. This allows you to access and modify the component's state and props within
-
Passing pointer to function expecting reference changes the value pointed
When a pointer is passed to a function that expects a reference, the pointer is dereferenced, and the value pointed to is passed as a reference. This means that any changes made to
-
jQuery unbind and bind keypress
In jQuery, the `unbind()` method is used to remove event handlers from elements. It takes one or more event types as arguments and removes all event handlers of those types from the selecte
-
Boost beginner, boost::bind nightmare
Boost::bind is a powerful tool in C++ that allows you to bind arguments to a function and create a new function object. This can be useful in many situations, such as when you want to pass
-
Tkinter - How to bind a key press (not button) to call a function?
python import tkinter as tk def my_function(event): print("Key pressed:", event.char) root = tk.Tk() # Create a label widget label = tk.Label(root, text="Press a key")
-
Boost bind return type difference
If the function being called has a void return type, the Boost Bind expression will also have a void return type. For example:
void myFunction(int x, int y) {
-
How can I unbind every single binding from a Tkinter root window
Here's an example code snippet:
python import tkinter as tk root = tk.Tk() # Bind some events to the root window root.bind("
", lambda event: print(" -
Unbinding specific jquery elements
To unbind a specific event handler from an element, you can use the `.off()` method. This method removes event handlers that were attached with `.on()` or `.bind()`. You can specify the eve
-
bind after unbind window Jquery
// Bind a click event to a button $('#myButton').on('click', function() { alert('Button clicked!'); }); // Unbind the click event from the button $('#myButton').off('click
-
How do I bind a closure to a static class variable in PHP?
class MyClass { public static $myVar; public static function setClosure($closure) { self::$myVar = $closure->bindTo(null, self::class); } } $closure = f
-
C++ socket programming bind function
The syntax for the `bind()` function is as follows:
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
Here, `sockf
-
How to resize text in javaFx
Text text = new Text("Hello, world!"); text.setFont(Font.font("Arial", 20)); // set font size to 20
In this example, we create a Text object with the