Random Homebrew: Space Shark
space shooter
lua but has an eboot
Friends: Coding 'n Cracking - Nymphaea - PS3 Forum - darkforestgroup - daxhordes.org - Tgames - coldbird - gopsp.it - pspstation.org - prometheus - hgoel.info - MakeSmartTV - ps vita

How can one "create" a file format?

Programming on your favorite platform, for your favorite platform? Post here

How can one "create" a file format?

Postby Nickolas » Mon May 28, 2012 2:31 pm

How can one create a file format? I am currently writing a mini programming language and my own tiny VM for learning purposes. I am interested in creating my own file format for the executables. Up to now, I have been using the BinaryWriter class and I would first create a new file, write a magic number to recognize the executable and then the instructions. Then I would use BinaryReader in the VM and instead of write, I read stuff. Now, I am interested in creating a completely new file format... How would you approach that?

P.S. This isn't really a programming question, but I found no other suitable section. Feel free to move it.
Image
Image
Image
Image
Nickolas
 
Posts: 382
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: How can one "create" a file format?

Postby m0skit0 » Tue May 29, 2012 11:08 am

Well you kind of can think about it as a programming question, but I don't understand what you mean exactly... To create a file format, you define its format first, then you might also want to generate some examples to process.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
User avatar
m0skit0
Guru
 
Posts: 4787
Joined: Mon Sep 27, 2010 6:01 pm

Re: How can one "create" a file format?

Postby Nickolas » Tue May 29, 2012 11:37 am

m0skit0 wrote:Well you kind of can think about it as a programming question, but I don't understand what you mean exactly... To create a file format, you define its format first, then you might also want to generate some examples to process.


That's what I meant. How can I define it? XML? Or just have the assembler write the code according to a definition?
Image
Image
Image
Image
Nickolas
 
Posts: 382
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: How can one "create" a file format?

Postby m0skit0 » Tue May 29, 2012 1:44 pm

I still don't understand. If it's your own file format, then it cannot be XML because XML already exists as a file format... Maybe what you mean is what format would be more suitable to your needs?
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
User avatar
m0skit0
Guru
 
Posts: 4787
Joined: Mon Sep 27, 2010 6:01 pm

Re: How can one "create" a file format?

Postby Nickolas » Tue May 29, 2012 7:07 pm

m0skit0 wrote:I still don't understand. If it's your own file format, then it cannot be XML because XML already exists as a file format... Maybe what you mean is what format would be more suitable to your needs?


Know, I meant how can I define it, so that my program can write instructions in order, according to the format. Should I use XML for defining it? I really have no idea. I could to it on a piece of paper and then tell my program to write the instructions accordingly, but I want it to automatically recognize the order so that I can change it later on.
Image
Image
Image
Image
Nickolas
 
Posts: 382
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: How can one "create" a file format?

Postby m0skit0 » Wed May 30, 2012 6:13 am

Oh yes, XML could be a good idea. Just keep in mind XML has no defined order, that is:

Code: Select all
<this>
    <is />
    <an />
    <example/>
</this>

is the same XML as

Code: Select all
<this>
    <example />
    <an />
    <is/>
</this>
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
User avatar
m0skit0
Guru
 
Posts: 4787
Joined: Mon Sep 27, 2010 6:01 pm

Re: How can one "create" a file format?

Postby Nickolas » Wed May 30, 2012 8:08 am

Nice I can use that. :) I'll look it up a bit. Thanks.
Image
Image
Image
Image
Nickolas
 
Posts: 382
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...


Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests