When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
22 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
elaborate
I have to read a file through stdin line by line. I need to ignore any lines that start with #, 1 or 0. I need to tokenize the next line that is split by semicolons and store the questions in an array.
Basically it’s one long line of questions separated by semicolons. I need to tokenize and move it to an array. This is my code so far but when I try and run it it’s an empty output of 38 lines (so it registers the lines but it just prints a new line)
I’ve commented some code out but I can only approach that when I figure the question_handler function out. Thanks again if you can help!!
the input file is on top and the output is the empty space below
@opal owl Has your question been resolved? If so, type !solved :)
Hmm what is sizeof(line)?
I'm pretty sure line is just a pointer, so size is 8. But you obviously want it to be 10000
Then. I'm pretty sure you want to test whether the first character is the digit '1', not the character with code 1. (Or 0)
So, it should be line[0] == '1'
Oh and every time you call the wuestion_handler, the index gets reset to 0
So it's overwriting questions
Skip lines that start with #, 0 or 1
Tokenize the lines that have a semicolon with them and store them in questions
I am unsure how to fix this if I could get any tips it would be amazing
Its still outputting empty new lines
Oh my god.. lol.. how did I not notice
You aren't even passing the array to the function.
Of course it is not changing anything, and array stays empty
Not in this case. No. line here is an array of size 10000
!solved
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity