convertion help

highboy

Newcomer
Joined
Nov 8, 2008
Messages
14
hi there hope everyone is well.i will try and explain what im trying to do here.i need to get the length of a file and the write that length into the file as an offset value i think lol.anyway this is what i have so far.
Code:
Dim fileDetail As IO.FileInfo
                fileDetail = My.Computer.FileSystem.GetFileInfo(GetFileNameFromPath(ofd.FileName) & ".gz")
                Dim aLong As Long = (fileDetail.Length)
                Dim str As String = (BitConverter.ToString(BitConverter.GetBytes(aLong)))
                Dim str1 As String = (str.Replace("-", ""))
                Dim str2 As String = (str1.Remove(6, 10))
                TextBox1.Text = str2
i want to write the result to say the yellow part in the hex view of the file like so

but when u write to the file it writes the part on the right hand side of the hex editor view window like this.

so if u can see what im trying to do please help an
d if u need anything else from me i will be glad to do what i can.thanks in advance
 
Could you just clarify what are you trying to do? Do you simply want to take afile's length and then shove this value into an existing file or use this length to locate an offset in the file?

Given the sample uses the .gz extension are you trying to manipulate gzip files in some way?
 
Could you just clarify what are you trying to do? Do you simply want to take afile's length and then shove this value into an existing file or use this length to locate an offset in the file?

Given the sample uses the .gz extension are you trying to manipulate gzip files in some way?

what im doing is compressing a file with gzip and putting a header on that file.to make the file work for me i need to calculate the file length of the gzip file and write it into the header.i also have to calculate the total length of the file im creating and write that value into the header.i hope that helps clarify it for you and thank you very much for the response.i needed this kind of thing before and just gave up but it was involving float values and such.
 
i tried to edit my post but anyway thanks for at least taking a look at my problem but i have figured it out so again thanks and have a great day.
 
Back
Top