| | |
For the love of GOD! Someone please help me!!!
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
You VB .NET developers out there,
I have posted 3 threads requesting help on reading floating point values from a binary file but did not get any reply at all. Is it because I am asking a stupid question or noone really have a clue about the question I asked? I am pretty sure that many of you know the answer. For the love of GOD, please give me some pointers on this. Following code just throws an exception at the first FOR NEXT loop where reading starts (Pls see the code below). I did manage reading integers from a binary file but just can't get it work to read floating point values.
Let me try to explain what I am trying to do. My program should read floating point values (values range between -1.00 and +1.00) from a binary file. After reading those floating point values, it will do some basic math with the values and then will write them into file.
Here is the code:
I have posted 3 threads requesting help on reading floating point values from a binary file but did not get any reply at all. Is it because I am asking a stupid question or noone really have a clue about the question I asked? I am pretty sure that many of you know the answer. For the love of GOD, please give me some pointers on this. Following code just throws an exception at the first FOR NEXT loop where reading starts (Pls see the code below). I did manage reading integers from a binary file but just can't get it work to read floating point values.
Let me try to explain what I am trying to do. My program should read floating point values (values range between -1.00 and +1.00) from a binary file. After reading those floating point values, it will do some basic math with the values and then will write them into file.
Here is the code:
VB.NET Syntax (Toggle Plain Text)
Dim s1 As FileStream 'Load file 1 Dim s3 As FileStream 'Save output If System.IO.File.Exists(TextBox19.Text) Then System.IO.File.Delete(TextBox19.Text) End If s1 = New FileStream(TextBox1.Text, FileMode.Open, FileAccess.Read) s3 = New FileStream(TextBox19.Text, FileMode.CreateNew, FileAccess.Write) Dim br1 As BinaryReader Dim bw As BinaryWriter br1 = New BinaryReader(s1) bw = New BinaryWriter(s3) Dim fLen1 As Integer Dim f1 As New System.IO.FileInfo(TextBox1.Text) fLen1 = f1.Length Dim snglRead1(fLen1) As Single Dim snglOutput(fLen1) As Single 'wıll hold results from division Dim i As Integer Dim j As Integer Dim k As Integer Dim m As Integer For i = 0 To fLen1 - 1 snglRead1(i) = br1.ReadSingle() 'EXCEPTION thrown right here Next For j = 0 To fLen1 - 1 snglOutput(j) = snglRead1(j) bw.Write(snglOutput(j)) Next s1.Close() s3.Close() MessageBox.Show("file created succesfully!", "Done") Me.Close() End If
“Remember: If you’re not experiencing failure, you’re not working hard enough!”
Jeffrey J. Mayer
Jeffrey J. Mayer
>I have posted 3 threads requesting help on reading floating
>point values from a binary file but did not get any reply at all.
So you've flooded the forum with threads asking the same question? That alone will cause people to ignore you.
>Following code just throws an exception
What exception? That's somewhat important information.
>point values from a binary file but did not get any reply at all.
So you've flooded the forum with threads asking the same question? That alone will cause people to ignore you.
>Following code just throws an exception
What exception? That's somewhat important information.
New members chased away this month: 3
•
•
•
•
For i = 0 To fLen1 - 1
snglRead1(i) = br1.ReadSingle() 'EXCEPTION thrown right here
Next
•
•
•
•
fLen1 = f1.Length
VB.NET Syntax (Toggle Plain Text)
fLen1 = Int(f1.Length / 4)
"give only what u willing to receive "
![]() |
Similar Threads
- I love this spam! (Geeks' Lounge)
- Collins: Why this scientist believes in God (Geeks' Lounge)
- Stirring the pot o' love.. (Geeks' Lounge)
- Will DOS games someday become impossible to play? (Troubleshooting Dead Machines)
- YaBasic: The beginners choice (Computer Science)
- simple calculations How? intHrlyRate, etc Help me (ASP)
- help (Geeks' Lounge)
- Final System Picked - Compatible? (Troubleshooting Dead Machines)
Other Threads in the VB.NET Forum
- Previous Thread: Results from Select statement differ in VB.NET and Access
- Next Thread: Automatic Files Sorting and Folders Creation
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 30minutes 2008 access application arithmetic array assignment basic binary bing box button buttons c# center code combobox component connectionstring convert data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dll dosconsolevb.net editvb.net error excel file-dialog firewall folder google hardcopy image images isnumericfuntioncall listview login math memory mobile ms mssqlbackend navigate net networking opacity output peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project record reports" save savedialog serial server sorting sql string studio temp text textbox timer toolbox updown upload useraccounts usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf






