When I save data to a Binary file using LC, what file extension should I use?
Is it bad to use txt as the file extension?
Thanks,
David
LC saved Binary files - What type of extension? - Solved
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
LC saved Binary files - What type of extension? - Solved
Last edited by DR White on Sat May 29, 2021 10:52 pm, edited 1 time in total.
Re: LC saved Binary files - What type of extension?
It would go against the grain to put binary data into a file with .txt extension, but there's nothing to stop you, and "bad" would depend on the consequences. If you have a binary file that someone tries to open in a text editor, and then it gets corrupted, that's less than desirable.
LiveCode will read any filename appropriately given a url("binfile:"<path/filename>) or url("file:"<path/filename>) to read from, whatever the extension, or even without.
If there is a usual convention for your data, you can follow that, or make up your own, or use something generic like ".dat" but it's really up to you.
LiveCode will read any filename appropriately given a url("binfile:"<path/filename>) or url("file:"<path/filename>) to read from, whatever the extension, or even without.
If there is a usual convention for your data, you can follow that, or make up your own, or use something generic like ".dat" but it's really up to you.
Re: LC saved Binary files - What type of extension?
SparkOut pretty much said it all, but to expand on a few things...
In most OS'es, the extension determines the default program to open said file, .txt, .text, .rtf, etc would indicate a text editor generically, .jpg, .png, .gif, etc a paint program, and so on.
In the olden days of yore, when the greater bulk of file name formats were originally concieved in 8.3 format, the extensions used primarily identified the file type {this is not necessarily true anymore}. Binary files usually used .bin, data files .dat, etc.
Naming files you create with your software should, as previously said, be of meaning to you, to aid your ability to quickly reference what type of file your bringing in or putting out to disk. If you filled a folder full of .txt files, aside from some passerby opening them incorrectly (and possibly corrupting them), you yourself may forget why that file is there.
If you create folders, I think the names you give those are equally important to consider in your naming conventions. It doesn't matter whether someone else can make sense of it or not (unless your programming as part of a collaborative or team).
Just my .02, although I'm not sure it is worth that much heh.
In most OS'es, the extension determines the default program to open said file, .txt, .text, .rtf, etc would indicate a text editor generically, .jpg, .png, .gif, etc a paint program, and so on.
In the olden days of yore, when the greater bulk of file name formats were originally concieved in 8.3 format, the extensions used primarily identified the file type {this is not necessarily true anymore}. Binary files usually used .bin, data files .dat, etc.
Naming files you create with your software should, as previously said, be of meaning to you, to aid your ability to quickly reference what type of file your bringing in or putting out to disk. If you filled a folder full of .txt files, aside from some passerby opening them incorrectly (and possibly corrupting them), you yourself may forget why that file is there.
If you create folders, I think the names you give those are equally important to consider in your naming conventions. It doesn't matter whether someone else can make sense of it or not (unless your programming as part of a collaborative or team).
Just my .02, although I'm not sure it is worth that much heh.
Re: LC saved Binary files - What type of extension?
Thanks both of you for your guidance!
David
David
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: LC saved Binary files - What type of extension? - Solved
Surely, in your case the obvious suffix for your binary files is .drw