2
What I’d like to do is put into a vector or matrix, information from a file txt
no prior knowledge of the number of "inputs" to know the size of the vector or matrix.
With the size of the vector or matrix, I can invoke the function malloc
and then read the contents of the file.
Could someone advise me the best way to do it? Thank you.
Good afternoon John, sorry I may not know the term
entradas
inC
(if it is a term), what do you really mean by entries? You are getting referendum toI/O
?– Guilherme Nascimento
Good afternoon, I’m still a bit of a beginner, maybe I haven’t referred correctly, what I meant as input is some information contained in the txt file that goes up to n, and after that would be another entry. Example of what I mean: in the file would have: name1 (space) age1 (space) Nome2 (space)... each name and age would be an entry, the name1 would be the first entry, the idea1 would be the second and so on...
– João
Perhaps it would be better for me to have said in general what I want to do and asked how to do it. I want to put in a vector or matrix the contents of a file, but do not know the "size" of the file to "by the vector size"
– João
@John, welcome to [en.so], you can [Dit] your question and put these details you commented on it, then you can browse the [tour] and learn a little more about Sopt
– mateusalxd
See if this helping.
– ramaral
Thank you, you helped me out.
– João
Would it not be better to use a dynamic chained list rather than a vector/matrix to store the data? So you don’t have to worry about the number of entries.
– igor.araujo