Are memory-mapped files really files? - file

If I create a memory mapped file and write some text to it, does that file behave like a filesystem file. I.e. does it have an extension?
If it does, does that mean I can create Excel files in memory, pictures and do I have to take the format of the file into consideration when working with it?
Or does it not have an extension and is just a glorified blob of text that persists in memory?

Related

How to read an excel file created by Microsoft Excel by CH376 IC?

In my embedded system I am using a CH376 IC (PDF link) for file handling. I am able to detect a Flash Disk, but not able to read the excel file created by Microsoft Excel. The excel file is created on the PC and copied in the Flash Disk.
I want to create a database in an Excel file on PC and after creating it, I want to upload in to my embedded system for this I need read the file created.
Please help me to read the file.
The .xls and .xlsx file formats are both extremely complex. Parsing them is unlikely to be feasible in an embedded environment. (In particular, .xlsx is a PKZIP archive containing XML data -- you will need a minimum of 32 KB of SRAM just to decompress the file containing the cell data, and even more to parse it.)
Use a different file format. Consider using .csv, for instance -- it's just a text file, with one row of data on each line, so it's pretty straightforward to work with.

.bin files used for upgrading embeded devices

I am confused a bit about .bin files. Basically in Linux we use elf, .ko type of files for upgrading the box or to copy in it . But, while upgrading a NAND flash in router or any Networking Gaint products why always .bin files is preferred. Is this is something like converged mix of all the OS related files. Does it possible to see the contents of a bin file. How to play with it. It is something like contents of BootROM. How is is prepared? How do we create and test on this. How Linux support for this. Any historical reasons behind this?
Speaking about routers, those files are usually just snapshots of a router's flash memory, probably compressed and with some headers added. Typical things are a compressed squashfs image or simply gzip'ed snapshot of memory.
There is no such thing as .bin format, it's just a custom array of bytes and every vendor interprets it in some vendor-specific way. Basically this extension means “it's not your business what's in the file, our device/software will handle it”. You can try to identify (thnk, reverse-engineer) what's actually in those files by using file utility or just looking at those files through a hex editor and trying to guess what's going on.

How can I put a file path into the clipboard so that it can be pasted as file in a file manager?

I want the user to be able to copy a file that's stored on disk from my GTK application to a normal file manager like Nautilus. How can I do that? I would prefer to just write a path into the clipboard and let the file manager take care of actually copying, is that possible?
I just found an example in which it seems as if the actual file data is transferred through the clipboard – but is that the only possible way?
You need CF_HDROP and possibly other shell clipboard formats.
See: http://msdn.microsoft.com/en-us/library/windows/desktop/bb776902(v=vs.85).aspx;

How are access times, modified times, encodings and filenames stored in files on NTFS and EXT3/4?

For academic and task related purposes I need to know how is file related data associated within files on NTFS and EXT. How does the operating system know file's name? How do editors know in which encoding to treat the file contents?
Are these details stored on a separate information location on the NTFS/EXT or are they included within the file itself?
On NTFS such information is stored not in the file itself but in the master file table (MFT).
You are asking many questions. I suggest you read up on the subject. Here is the short version, and here is everything in full detail.

Read and write directly from and to compressed files in C

in Java I think it is possible to cruise through jar files like they were not compressed. Is there some similar (and portable) thing in C/C++ ?
I would like to import binary data into memory from a large (zipped or similar) file without decompressing to disk first and afterwards writing to disk in a compressed way.
Maybe some trick with shell pipes and the zip utility?
I think you want zlib:
http://www.zlib.net/

Resources