LC saved Binary files - What type of extension? - Solved

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DR White
Posts: 685
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

LC saved Binary files - What type of extension? - Solved

Post by DR White » Sat May 29, 2021 8:18 pm

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
Last edited by DR White on Sat May 29, 2021 10:52 pm, edited 1 time in total.

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: LC saved Binary files - What type of extension?

Post by SparkOut » Sat May 29, 2021 9:25 pm

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.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: LC saved Binary files - What type of extension?

Post by bogs » Sat May 29, 2021 10:42 pm

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.
Image

DR White
Posts: 685
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Re: LC saved Binary files - What type of extension?

Post by DR White » Sat May 29, 2021 10:52 pm

Thanks both of you for your guidance!

David :D

richmond62
Livecode Opensource Backer
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

Post by richmond62 » Sun May 30, 2021 3:41 pm

Surely, in your case the obvious suffix for your binary files is .drw 8)

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”