If I have a file 1000Kb, I would like to divide it into 2 part 50-50, can you tell me how to do that ? Is it possible ?
If it is, then how can I "heal" it again ?
Mmm, i don't quite understand what you are trying to do
You can just open your 1000kb file in binary mode, read and write 500 kb of it to a new file and the last 500 kb to another file.
To merge them, just open the first part in binary, copy it to the new merged file. Then open the second part and append that to the new merged file.
Thanks Marc G for telling me that my question is unclear and giving me ideas...
Originally posted by Marc G
Mmm, i don't quite understand what you are trying to do
You can just open your 1000kb file in binary mode, read and write 500 kb of it to a new file and the last 500 kb to another file.
To merge them, just open the first part in binary, copy it to the new merged file. Then open the second part and append that to the new merged file.
hahahu...
But now I understand how to solve this problem....
I d like to ask another question : do you know why people gurus like you keep saying about modes(binary, some.others.I.dont.know.yet) what is a mode ? why is it necessary ? does mode help me do what ?
If you have a text file, then each line should end with \r\n or \n.
When you open a text file in text-mode, each \n will be replaced with \r\n. When you open the file in binary-mode, no such conversion takes place. Conclusion: When you do not want conversions to happen behind your back, open the file in binary. Because you said you wanted to split the file in 2 and then merge them back in one, you want the resulting file to be exactly like the original, don't you. Therefore open the file in binary, and no conversion will take place.
Originally posted by Marc G
Note: I only speak about Windows.
If you have a text file, then each line should end with \r\n or \n.
When you open a text file in text-mode, each \n will be replaced with \r\n. When you open the file in binary-mode, no such conversion takes place. Conclusion: When you do not want conversions to happen behind your back, open the file in binary. Because you said you wanted to split the file in 2 and then merge them back in one, you want the resulting file to be exactly like the original, don't you. Therefore open the file in binary, and no conversion will take place.
(ha)^n.(n->infinity)
I mean I laugh alot, now I know about binary mode, but actually I dont care about conversions.
Thanks so much for your help, I will try to remember all of what you said...
Regards,
Fiona
I care about this, no matter HOW and what it is, just think I am guilty and from now I gotta do something to repay...That cant be but another different form can ...<--If you dont understand, forget it, I want that reader to undestand this and that s all !!!
Last edited by Homestead; January 3rd, 2004 at 02:28 PM.
I just wanted to tell you that in my opinion Marc G gave you a clear answer to your question.
You wrote your question in human language, that meant you needed the algo to resolve that problem. You got that algo from Marc G.
Did you consider you would get a ready-to-compile program text? Some of the members of these forums do sometimes do so, but would that be of use to you?
If you just want to solve your task of splitting and merging a file you can use one of a number of utils that you can find over the inet. Otherwise, if you want to learn C++ this way, try it step-by-step. At least one line of code would be enough for the community to start helping you.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.