Sep 9, 2017 01:06 PM
(This post was last modified: Sep 9, 2017 02:31 PM by Tralen.)
EDIT: PROBLEM SOLVED JUST HAD TO USE STRCPY() THANKS FOR THE HELP!
It has been a while since i've messed with structs in C so the solution to my problem may be very simple but I just can't figure it out. I would usually ask questions like this on stackexchange but the people over there are jerks so I figured I would rely on this community instead.
so I have the following struct declared
The last 2 lines are the one where the Invalid Array Assignment error is coming up. I don't think its a problem with the dirent struct (which is assigned to de) as i've used it to print the names of the files. Here is a link to the entire code, thanks in advance for any help.
https://pastebin.com/z9KBwYAG
It has been a while since i've messed with structs in C so the solution to my problem may be very simple but I just can't figure it out. I would usually ask questions like this on stackexchange but the people over there are jerks so I figured I would rely on this community instead.
so I have the following struct declared
Code
typedef struct list{
char name[256];
int size;
}list;
//I then init the 2 with integers I get from figuring out the # of files in a directory
list directories[numOfDirectories];
list files[numOfFiles];
//then inside of a loop I try assigning values to them.
directories [dirCount++].name = de->d_name;
files[fileCount++].name = de->d_nameThe last 2 lines are the one where the Invalid Array Assignment error is coming up. I don't think its a problem with the dirent struct (which is assigned to de) as i've used it to print the names of the files. Here is a link to the entire code, thanks in advance for any help.
https://pastebin.com/z9KBwYAG


