FLTK logo

RE: [fltk.general] Re: Does Fl_Image always release the lock on the fileit is reading

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

RE: Re: Does Fl_Image always release the lock on the fileit is reading "'Philip Rose' via fltk.general" Jul 27, 2022  
 

From: lifeatt...@gmail.com
Sent: 27 July 2022 15:07
To: fltk.general
Subject: [fltk.general] Re: Does Fl_Image always release the lock on the fileit is reading

 

Fl_Image doesn't have any link to the file or other resources. Fl_PNG_Image does an fopen() and a fclose().

 

So the following sequence (FLTK 1.4, Linux, installed PNG library) works:

 

    Fl_Image *img;
    Fl_Image *imgc;
   
    img = new Fl_PNG_Image("folder.png");
    imgc = img->copy(250, 250);
    delete img;
   
    FILE *imgF = fopen("folder.png", "wb");
    fputc(0, imgF);
    fclose(imgF);

The file which was opened by Fl_PNG_Image is successfully clobbered by the subsequent fopen/fputc.

 

I have noticed that I am not allowed to update a file after I've opened it with Fl_PNG_Image.

 

--

 

 

Thanks,

 

I didn’t think it would be a problem. I’ll need to look elsewhere if it happens again.

 

I am running on W10 using the libraries from fltk. FLTK 1.4.

 

Phil.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/62e198c1.1c69fb81.7219e.bc32SMTPIN_ADDED_BROKEN%40gmr-mx.google.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.