Re: New Problem in Dialog
donJ <[email protected]> Mon, 16 Apr 2018 16:37:56 -0500
| Newsgroups | gmane.comp.lang.realbasic.user |
|---|---|
| Message-ID | <[email protected]> |
On 04/16/2018 01:27 PM, Daniel Drijard wrote: > I have a new dialog problem (possibly connected to my recent one). > I want to select a text file in a folder. Thus I gather some text > files to which I affect or not the extension .txt. Some of them are > accessible (accepted) by the dialog, others not. The point is that I > have 2 pieces of code which behave differently for this, one > requesting the .txt extension the other refusing it. > My question is about understanding what is defining the Text > style. There is the .txt extension but there must be an internal > file’s characteristic. The program which generated the file must be > somewhat indicated in the file. > I do not know what the dialog uses to accept/reject a file. > > Daniel > > Hi Daniel, Others can probably help you more with some of this, but maybe this will help. There is nothing in a text file that identifies the creator. You can see this if you make a text file with a single ASCII letter in it and check the size. It will be one byte. Permissions, dates, etc. are maintained by the file system and used by the file manager. If the .txt extension is not enough, you may have to read the first part of the files and look for some characteristic that your app will identify. I don't know what operating system you are using, but it may be that the dialog box is using a system function to select what to include. My linux systems scan the files and if all characters can be interpreted as printable (plus a few CR, TAB, etc) characters, it will try to open the file in a text editor unless the file has executable permissions. Don