highboy Posted January 23, 2009 Posted January 23, 2009 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 Quote
Administrators PlausiblyDamp Posted January 24, 2009 Administrators Posted January 24, 2009 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? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
highboy Posted January 24, 2009 Author Posted January 24, 2009 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. Quote
highboy Posted January 25, 2009 Author Posted January 25, 2009 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.