Re: [cc65] Common macros for dirent.d_type

From: Groepaz <>
Date: 2012-07-04 23:01:33
On Wednesday 04 July 2012, you wrote:
> Sorry, but just some simple questions:
> - I think I understood from your discussion that both USR and PRG
> files can be read successfully without fiddling with '_filetype' -
> correct?

unless different files with the same name but different type are on the same 
disk, i guess thats true. i have changed the default to PRG since ages (and 
never used other filetypes), so i cant tell for sure =)

> - So the question is what type of file is created on writing a file.
> What does 'S' do? From what I understand here it creates PRG files.
> But what's the difference to 'P' then?

S -> SEQ, P -> PRG, U -> USR

and there is no difference with using these, except the filetype in the 
directory is different. (its really just a single byte :)) the internal 
structure is exactly the same. as said before, it doesnt really matter if you 
stay in cc65 universe - it matters when you break out and want to create files 
that other existing programs can deal with (which are in the vast majority prg 

> - What happens if a file already exists? Is the filetype preserved on
> "overwriting" the file?
> I need to understand this specifically because my Contiki disks so far
> depend on the 'contiki.cfg' file being _not_ PRG. What do I need to
> set '_filetype' to in order to get the previous behaviour?

generally i want to answer this question like this: its a bad idea to 
overwrite a file, you should first delete it (using the dos "scratch" command) 
and then write it again. if you dont do that you might trigger the "save-with-
replace bug" and eventually destroy the disk in the process (ie, lose data)

as for the original question - its preserved as far as i know :)

> > i would even say that by making it prg, you will 100%
> > eliminate any "how do i change the default filetype" questions
> My section above already proves this claim to be wrong on the very first
> day!

no - for you the question only arises because you - for whatever reason - used 
a different filetype before. again, it doesnt matter at all inside cc65 world, 
you can use whatever you want there with no drawbacks at all.


Man kann auch saufen statt rumweinen. Hilft gleichzeitig der Wirtschaft und 
dem Staat! 

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Jul 4 23:00:50 2012

This archive was generated by hypermail 2.1.8 : 2012-07-04 23:00:54 CEST