Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

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

http://img516.imageshack.us/img516/7046/sendhl3.jpg

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

http://img242.imageshack.us/img242/4457/send1cl3.jpg

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

  • Administrators
Posted

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?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...