Bubblesort with unknown size struct read from a bin file
Hello folks, can you help me please?
I have a binary file, and I want to pass these infos to a TXT ordered file.
I can pass the data without problems if I don' try to order: I created a vector of struct of size 2, and I go reading the bin file, if my count of lines, get to the number 2, I write the data on the txt, then I put my count as zero again, and using this way, I can make it work without actually knowing how many lines my bin file has...
Well, the problem is: by this method, I'm constantly deleting my structs, so how can I order the data?
PS: I dont know how to allocate vector dinamically, so for now I want to understand how could I use a bubble sort to order these data from my bin file and then pass to a txt file, if I dont know how long this file is.
Thanks in advance,