realbasic-nug
[Top] [All Lists]

Unhandled Exception Error assistance.

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Unhandled Exception Error assistance.
From: Web Masters iMac <ecox at mac dot com>
Date: Thu, 31 Jan 2002 12:55:57 +1100
Hi,

The following code generates an Unhandled Exception Error in bs.Write s

Synopsis: having opened a valid JPEG file and into String s I am now writing
the resultant string back to a temporary file ready to be read in again and
displayed (on a Canvas.backdrop ? other suggestion?)

Kevin Ballard where are you??! Your email address bounced.. dropped off the
face of the earth?

Kind Regards,

Ed Cox
ecox at bigpond dot net dot au
Sydney, Australia


----

  Dim f As FolderItem
  Dim p As Picture
  Dim ReadFromFile As BinaryStream
  Dim bs As BinaryStream
  Dim s As String
  
  f = GetOpenFolderItem("image/jpeg")
  if f = nil then
    return
  end if
  
  ReadFromFile = f.OpenAsBinaryFile(False)
  ReadFromFile.LittleEndian = True // assume JPEG uses LittleEndian value?
  s = ReadFromFile.Read(ReadFromFile.Length)
  ReadfromFile.Close
  
  f = GetFolderItem("temp.JPG")
  if f.Exists then
    f.Delete
  end if
  
  bs = f.CreateBinaryFile("jpeg")
  bs.Write s
  bs.Close
  
  p = f.OpenAsPicture
----

Am I missing something obvious?



<Prev in Thread] Current Thread [Next in Thread>