Announcement

Collapse
No announcement yet.

Problem displaying image files.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem displaying image files.

    Well, the workaround for FAT16 in new Workshop works (http://www.websitetoolbox.com/tool/p...ost?id=3317726) and so I could test my projects developed under earlier versions.
    Since new workshop I have the problem that I'm unable to display images from file. The following code should load and display an image file "M<idx>.GCI" that is stored at the µSD.

    Code:
    func ShowKatImage( var idx)
     to(Filename);print("M",[DEC3Z] idx,".GCI");    //saves the filename to array   "M001.GCI"
     print([STR] Filename);
     if(file_Exists(Filename))                         //check if file exists
       print(" exists\n");
       iFile:= file_Open(Filename, 'r');               //Open File for reading
       print("File handle: ",[HEX] iFile);
       file_Image(130,160,iFile) ;
       file_Close(iFile) ;
     else
       print(" don't exist\n");
       iFile:= file_Open("no_pic.gci", 'r');               //Open File for reading
       file_Image(130,160,iFile) ;
       file_Close(iFile) ;
     endif
    endfunc
    The "print" lines are only for debuging and on the screen the following messages will appear.

    M001.GCI exists
    File handle: 0000

    The image itself will not appear and the file handle 0000 is very interesting. Is the function file_Open unable to open image files? Other files like text files seems to work (but not fully checked yet).

  • #2


    I found out whats going wrong.

    iFile:= file_Open(Filename, 'r'); does not work
    iFile:= file_Open("M001.GCI", 'r'); works

    btw. filename is defined as

    var Filename[20];

    Comment


    • #3


      Use

      iFile:= file_Open(str_Ptr(Filename), 'r');

      You should be using str_Ptr for all file_xxxxx filename variables from now on.

      Comment


      • #4


        Thanks.
        It works but such changes should be included in 4DGL documentation.

        Comment

        Working...
        X