
Read large file in small bytes
Read large file in small bytes
Hi all I'm wondering if I have a large file for example a file that is 5gb large. Can I read it and write it in small bytes (e.g. a byte that is 100mb large) and how can I make this ? Thank you 

Re: Read large file in small bytes
Split file?
Code: Select all
EnableExplicit
Define.s BigFile = "c:\my big file.dat"
Define.s SmallFiles = "c:\my smallfile_"
Define.i BF, SF, length, count = 1, bufSize = 100 * 1024 * 1024
Define *buf = AllocateMemory(bufSize)
BF = ReadFile(#PB_Any, BigFile)
If BF
While Not Eof(BF)
length = ReadData(BF, *buf, bufSize)
If length
SF = CreateFile(#PB_Any, SmallFiles + Str(count))
count + 1
If SF
WriteData(SF, *buf, length)
CloseFile(SF)
EndIf
EndIf
Wend
CloseFile(BF)
FreeMemory(*buf)
EndIf
Re: Read large file in small bytes
Oh thank you very much but how can I combine splited files back in one file after I separete them in parts 

Re: Read large file in small bytes
write the first file, the second and so on and close the new file 
