Hi everybody,

I would like to know how can i read the header of all sort of of files.

to be more specific, i want to write a function in c# that returns header of any local file.
I wanna call it like this

giveMeHeader("c:\folder\mytextfile.txt")

or

giveMeHeader("c:\folder\song.mp3")

and that returns me full header information and data context, both as string.


Then I want to store two information on DB or somewhere else to create files whenever i want with header and context info.


How can i do this from the easiest way?


Thanks a lot in advance,

HEADER Header;

void ReadHeader(FILE *fp)
{
if (fp != (FILE *)NULL)
{
fread(&Header.Id, sizeof(Header.Id), 1, fp);
fread(&Header.Height, sizeof(Header.Height), 1, fp);
fread(&Header.Width, sizeof(Header.Width), 1, fp);
fread(&Header.Colors, sizeof(Header.Colors), 1, fp);
}
}

thank u arjun but i couldnt get a point

is FILE filepath as string?

and what type does this function returns?


and this contains "Header.Colors" so if any file i try to get header of, becomes a txt file or mp3, will that make a problem because i cant mention about a color in sound file. im confused a little..

isnt there anybody else who can guide me somehow please??

You don't need header files in C#. Just put each class definition in its own file. The compiler knows where to find them. The only thing to watch out for is namespaces. If two classes are in different namespaces, then you'll have to include a "using" statement to import the namespace the other class is in.

no no i have been misunderstood.

All i want to be able to embed a music or image file into database.
Shouldnt' I get the "header of image/media file" for that operation?

Best Regards,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.