On 25 Sep, 01:56, Richard<rgr...@gmail.comwrote:
"Bill Cunningham" <nos...@nspam.invalidwrites:
* * I can't use stdc to write a file signature for a file format can I?
what's a file signature? Do you want a way of deducing the file type
by reading some sort of meta-data? comp.programming is probably
the place to go. This sort of file signature stuff is highly OS
dependent.
Windows: use the file extension
old Mac OS: stick something in the resource fork of the file
(yes you would need "kernel" calls for that!)
unix: uses something called "magic" which is essentially
stuff at the front of the file
Wouldn't I have to get into the sys calls and maybe even kernel internals to
do this with lynx.
lynx?
wiki: "The LynxOS RTOS is a Unix-like real-time operating system from
LynuxWorks (formerly "Lynx Real-Time Systems"). Sometimes known as the
Lynx Operating System, LynxOS features full POSIX conformance and,
more recently,
Linux compatibility. LynxOS is mostly used in real-time embedded
systems, in applications for avionics, aerospace, the military,
industrial process
control and telecommunications."
I bet you didn't mean that
I am going to write a parser soon.
<giggle>
But I want to parser
to have a unique signature in it's header somewhere. 0x7f is I believe the
signature for linux.
no
I will write a 128 unique number generator in C with
linux to get the number so it will not conflict with other file types like
adobe's .pdf and so on. Can anyone suggest any source code to create a file
signature and what else I might need to do?
the simplest think to do on Unix-like system is to put
some fairly simple text on the first line and hide it
in a comment. Suppose I was posting something that used ;
as a comment I could tag my file like this
;!/bin/nil
The perl programming langauge often tags its programs with
#!/opt/perl5/perl
the ! sequence tells the shell (the Operating System in effect)
where to find the correct reader for that file type. Ask on a Unix ng
for details.
--
Nick Keighley