Nakh0d4
09-06-2012, 21:09
تو فايل 5 ذخيره ميشه تو خوندن 4354مثلا خونده ميشه!!!!!!!!
Private Sub write_in_file_x_y_Color(ByVal x As Int16, ByVal y As Int16, ByVal Pixel_color As Byte)
FileClose(1)
FileOpen(1, System.IO.Path.GetTempPath() + "\XY.hm", OpenMode.Binary)
Dim xx, yy As Int16
Dim cc As Byte
file_record_write_pixel += 1
xx = x
FilePut(1, xx, file_record_write_pixel)
yy = y
file_record_write_pixel += 1
FilePut(1, yy, file_record_write_pixel)
file_record_write_pixel += 1
cc = Pixel_color
FilePut(1, cc, file_record_write_pixel)
FileClose(1)
End Sub
و خوندنش
Private Sub read_in_file_x_y_Color()
Dim X_array_for_read_from_file(500), Y_array_for_read_from_file(500) As Int16
Dim Color_array_for_read_from_file(500) As Byte
FileClose(1)
FileOpen(1, System.IO.Path.GetTempPath() + "\XY.hm", OpenMode.Binary)
' read data form file and save in array
Dim num_of_record As Integer
num_of_record = (LOF(1)) / 3
Dim record_temp1 As Int16
For index_read As Int16 = 1 To num_of_record
Dim temp As Int16
Dim color_temp As Byte
record_temp1 += 1
FileGet(1, temp, record_temp1)
X_array_for_read_from_file(index_read) = temp
record_temp1 += 1
FileGet(1, temp, record_temp1)
Y_array_for_read_from_file(index_read) = temp
record_temp1 += 1
FileGet(1, color_temp, record_temp1)
Color_array_for_read_from_file(index_read) = color_temp
Next
End Sub
Private Sub write_in_file_x_y_Color(ByVal x As Int16, ByVal y As Int16, ByVal Pixel_color As Byte)
FileClose(1)
FileOpen(1, System.IO.Path.GetTempPath() + "\XY.hm", OpenMode.Binary)
Dim xx, yy As Int16
Dim cc As Byte
file_record_write_pixel += 1
xx = x
FilePut(1, xx, file_record_write_pixel)
yy = y
file_record_write_pixel += 1
FilePut(1, yy, file_record_write_pixel)
file_record_write_pixel += 1
cc = Pixel_color
FilePut(1, cc, file_record_write_pixel)
FileClose(1)
End Sub
و خوندنش
Private Sub read_in_file_x_y_Color()
Dim X_array_for_read_from_file(500), Y_array_for_read_from_file(500) As Int16
Dim Color_array_for_read_from_file(500) As Byte
FileClose(1)
FileOpen(1, System.IO.Path.GetTempPath() + "\XY.hm", OpenMode.Binary)
' read data form file and save in array
Dim num_of_record As Integer
num_of_record = (LOF(1)) / 3
Dim record_temp1 As Int16
For index_read As Int16 = 1 To num_of_record
Dim temp As Int16
Dim color_temp As Byte
record_temp1 += 1
FileGet(1, temp, record_temp1)
X_array_for_read_from_file(index_read) = temp
record_temp1 += 1
FileGet(1, temp, record_temp1)
Y_array_for_read_from_file(index_read) = temp
record_temp1 += 1
FileGet(1, color_temp, record_temp1)
Color_array_for_read_from_file(index_read) = color_temp
Next
End Sub