Hello all,
I input data from a file into an array of strings, where each string represents a complete line from the file(the elements in each line is separated by commas). Now, I am trying to separate the elements in each line based on commas. (Basically I wanna take the commas out of the lines).
I use a for-loop to go through the lines of the file. For each line, I use a while loop to separate the elements by the commas in the file. However, I get segmentation fault when I run the program, which compiles just fine. I would like to know where am I going wrong using the loop.
**Some lines end with two commas following each other (be mindful of that).
Thank you.
That was a typo (it happened while I was typing it to post it here).
But, anyway, yes it is name = array[i]; // not arrayy[i]
Each array[i] is a string or (a line from a file).
Thanks for noticing that... But, this is not the problem.
i get a segmentation fault every time I run the program... It prints out just half of the lines from the array.