I got this piece of code: This will print all lines of the file, but as soon as I uncomment the strncpy(), the program just stops without error. S ...
I got this piece of code: This will print all lines of the file, but as soon as I uncomment the strncpy(), the program just stops without error. S ...
I tried to limit the number of n bytes copied to dest (here str1) by using strncpy(). The dest is big enough for the n bytes, but the output produced ...
My program receives data in the form of std::vector<boost::asio::const_buffer> buf_vect. I need to combine the const_buffer in the vector into a ...
I'm trying to make an algorithm for strncpy I read how it work in the manual and made my algorithm then I made a test to see if there's any difference ...
I tried 2 different approaches to build a function that accepts string input from user and stores it in a variable. Implementation A Implementatio ...
I'm dealing with struct that have fixed-size char arrays. Let's say I really, really want to keep struct size small (or I need to send them over net ...
I am trying to write a program that will dynamically allocate enough space to store all the words in a 1D char array separated by a space. ex: char* l ...
I'm trying to learn how to update some shared memory using threads without using global variables, but I keep getting "segmentation faults (core dumpe ...
I am attempting to take code that I have written in C++ for some basic problems, then re-writing in other languages as a way to become more familiar w ...
I need to write c program to compare two strings without using strncpy() and then in another funtion check whether it works with using assert() In my ...
So, I am trying to write an strncpy function. I want user to input the number of characters to be copied from source. I am doing something wrong, but ...
http://www.jbox.dk/sanos/source/lib/string.c.html#:38 ...
I am trying to copy substring of s to pointer to an array of strings. And below is my code. I have allocated the memory using malloc. But when I try t ...
I need to extract a substring from a string with different length. I would like to avoid using malloc. Is this safe? I'm wondering if this could b ...
I got to know about the function - strncpy_s(), which is called the secure version of string copy. More secure than the functions - strcpy() and strnc ...
as you can see, I initialized MAX_SIZE is 1000. when MAX_SIZE is not greater than buffer, MAX_SIZE become zero. the code's output like this: how ...
I got this homework to decide what the following code will do (on paper, without testing on computer). When I wanted to check if I did it right, I ...
I want to copy two parts of string s to two strings a and b: Result: I had expected What has happened to a? Can anybody tell me what is wrong ...
I tried to think how to make the function strncpy and I met this problem. Output What is happening ? ...
Here is a problem. When I try to convert it by using strncpy_s, array has some type of "trash data" from memory in the end of it. Even when I fill buf ...