Hi c99tutorial,
As far as I can tell, when I type:
FILE* fp = fopen("C:/Project/My Folder/output.csv", "w");
fprintf(fp, "Hello. This is foo.csv.\n");
fclose(fp);
It writes the...
Type: Posts; User: NotAProgrammer
Hi c99tutorial,
As far as I can tell, when I type:
FILE* fp = fopen("C:/Project/My Folder/output.csv", "w");
fprintf(fp, "Hello. This is foo.csv.\n");
fclose(fp);
It writes the...
Hi Algorism,
The exact output is [C:/Project/My Folder/output.csv] so it looks like there are no weird formatting characters with the spaces. How do I get C to recognize the string as a file path...
Hi Salem,
The literal string works absolutely fine and it look like the entire string is passing through the function. That's why I thought trying to paste quotes around it might work, but there...
Hi all,
I am writing a C function that can be called through R and am running into problems with passing file path name strings that contain spaces. I know it is bad practice to have spaces in path...
I think I just solved my own problem. I shouldn't have malloc'ed memory to the array pointers when initializing the array because I then lose that memory when I allocate a new head node to the list. ...
Hi folks,
Having some frustrating issues trying to free memory from a dynamically allocated array of pointers to linked lists. I think the problem is in how I initialize the pointers to NULL. Is...
I gave up trying to get realloc to work in the for loop without leaking memory and instead re-wrote the code using linked lists to temporarily store the new array elements. At the end of the for...
This is a much simplified version of the way the function is currently called in the program, but compilable.
I am a little bit confused by:
"There is also a memory leak as, when reallocating...
Happy holidays C gurus! I am running into a strange error using realloc to resize a 2D array within a function and could use some advice.
The function is designed to remove duplicate entries...
Thanks! - initializing the anim_list array values to NULL did the trick and I definitely would not have spotted that without your help so much appreciated.
I can't remember why I originally set up...
Hi guys,
I am trying to create an array of structs and then initialize values in the array of structs contained within each node. I keep getting a segmentation fault error when the program tries to...
Hi C wizards,
I am working on a demographic simulation model where I have a population of individual people represented as structs:
struct person
{
int age;
struct person *next_node;...
That absolutely did the trick and thank you for the great explanation. I am posting the final code in case some other wayward soul with qsort problems stumbles across this thread.
#include...
Worked like a charm once I changed the qsort call. Thank you so much for taking the time to look at my code! Now to plug it back into the rest of the program.
Thanks. I did try using various print statements and breakpoints to chase down the error before posting here. The array appears to initialize, but qsort passes a NULL pointer to argument 2 of the...
Hi,
First time posting on this forum and I have an embarrassingly newbie question about using qsort with dynamically allocated 2D arrays.
I need to sort a large dynamically allocated 2D integer...