Click here to Skip to main content
15,892,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionEfficient way to read/write file Pin
manoharbalu7-Jun-20 22:32
manoharbalu7-Jun-20 22:32 
AnswerRe: Efficient way to read/write file Pin
CPallini8-Jun-20 1:28
mveCPallini8-Jun-20 1:28 
AnswerRe: Efficient way to read/write file Pin
Greg Utas8-Jun-20 2:23
professionalGreg Utas8-Jun-20 2:23 
AnswerRe: Efficient way to read/write file Pin
kalberts8-Jun-20 4:32
kalberts8-Jun-20 4:32 
AnswerRe: Efficient way to read/write file Pin
Joe Woodbury8-Jun-20 14:24
professionalJoe Woodbury8-Jun-20 14:24 
GeneralRe: Efficient way to read/write file Pin
kalberts8-Jun-20 20:04
kalberts8-Jun-20 20:04 
GeneralRe: Efficient way to read/write file Pin
Joe Woodbury8-Jun-20 23:25
professionalJoe Woodbury8-Jun-20 23:25 
GeneralRe: Efficient way to read/write file Pin
kalberts9-Jun-20 3:54
kalberts9-Jun-20 3:54 
I am happy to see that you have rock solid confidence in today's high fashions. Keep it up! We need enthusiasts.

Nevertheless: When you work on digital library projects with the aim to preserve information (as contrasted to "data" and "files" - the semantic contents!) for at least one hundred years, maybe five hundred, then things come in a different light.

To illustrate problems, I used to show the audience an XML file where everything was tagged in Northern Sami. It made little sense to anyone (except that Sami guy who had helped me make the file). So why couldn't the entire world speak English? My next example was one where a 'p' tag identified a 'person', a 'part' or a 'paragraph', depending on context. It makes little difference whether those are XML or JSON tags if they make no sense whatsoever to the reader, or are highly ambiguous unless you have extensive context information.

Of course you can loose information! Say that you want to preserve a document where page formatting is essential (it could be for legal reasons, or other): For this digital library project, it didn't take me long to dig up seven different stragegies in use in various text processing systems for how to handle space between paragrahps in connection with page breaks. If you can "do an XKCD 927" and replace the 14 existing standards with a 15th replace them all, then good luck! Many have tried, none have succeeded. When you select a format, whether JSON, MS-Word, HTML, PDF or any other for your document storage, and convert documents in other formats to the chosen one, you will lose information.

I could show you a pile of different physical media with my old files, totally inaccessible today. If you want to preserve data, you cannot simply say "forget about physical formats, interfaces, media - as long as we use JSON it is safe". No, it isn't. The Travan tape reader uses its own interface card, for the ISA bus. I no longer have a PC with an ISA bus. I've got one SCSI disk with a 50-pin connector, it is not the Centronix 50-pin but a "D"-connector with three rows of pins. I once had a 50-pin D-to-Centronics cable, but even if I had saved it, I have no SCSI-interface where it fits. I have got the full source code of the OS I was using, on an 8-in harddisk cartridge disk, but this millenium I haven't seen a reader for it. I still keep a Win98 PC alive: If I plug the USB floppy disk reader into a modern (XP or later) PC; it won't read floppies without a proper format code in the boot sector. Win98 could.

Sometime in the 1990 I has a user coming with 8" floppy disks from an old project, asking if we could still handle them - I was the one who still had a reader for those. The user had no idea about formats at any level, but they needed all the information they could get from these floppies, whatever it was. I copied each floppy to a disk file for analysis; at first it looked like digitzed white noise. It was suspected to be text, so I ran a count of byte values: the most common values where the EBCDIC values for 'e' and 't'. EBCDIC comes in many variants ("code pages"), and we had to try a few before getting all the characters right. That made it possible to identify the block size, and I could start flipping unordered blocks around to make longer strands of coherent text.

Then I might have found some JSON (if it had existed by then) to start to identify the information - the semantics. Forunately, the information was not in Northern Sami. Or in French - in another project, we obtained another structured text, a C source library for record management, that had high reputation. When we got the source code, all variable names, all comments, all documentation, was in French, a language none of us mastered. We were unable to make the extensions to the library that we had planned.

Long time information preservation and recovery goes far beyond JSON style "firstName" : "Peter", "age" : 51, ... JSON is no more than some dots of foam on top of the ocean. Cute enough for a demo, and you may even employ it for something useful! But dig down in history to see how ASCII was introduced as the final solution for all computers all over the world to interchange arbitrary data, the solution to all interconnect problems. The universal format for all purposes. Yeah, right.
GeneralRe: Efficient way to read/write file Pin
Joe Woodbury9-Jun-20 7:20
professionalJoe Woodbury9-Jun-20 7:20 
GeneralRe: Efficient way to read/write file Pin
charlieg11-Jun-20 11:53
charlieg11-Jun-20 11:53 
GeneralRe: Efficient way to read/write file Pin
kalberts11-Jun-20 19:39
kalberts11-Jun-20 19:39 
GeneralRe: Efficient way to read/write file Pin
charlieg12-Jun-20 8:30
charlieg12-Jun-20 8:30 
QuestionDoes WaitForSingleObject timeout after 49 days if INFINITE is passed? Pin
PrafullaVedante7-Jun-20 9:02
PrafullaVedante7-Jun-20 9:02 
AnswerRe: Does WaitForSingleObject timeout after 49 days if INFINITE is passed? Pin
Greg Utas7-Jun-20 11:00
professionalGreg Utas7-Jun-20 11:00 
AnswerRe: Does WaitForSingleObject timeout after 49 days if INFINITE is passed? Pin
RedDk7-Jun-20 12:17
RedDk7-Jun-20 12:17 
AnswerRe: Does WaitForSingleObject timeout after 49 days if INFINITE is passed? Pin
CPallini7-Jun-20 20:40
mveCPallini7-Jun-20 20:40 
GeneralRe: Does WaitForSingleObject timeout after 49 days if INFINITE is passed? Pin
PrafullaVedante8-Jun-20 0:09
PrafullaVedante8-Jun-20 0:09 
GeneralRe: Does WaitForSingleObject timeout after 49 days if INFINITE is passed? Pin
CPallini8-Jun-20 1:21
mveCPallini8-Jun-20 1:21 
GeneralRe: Does WaitForSingleObject timeout after 49 days if INFINITE is passed? Pin
Joe Woodbury8-Jun-20 15:04
professionalJoe Woodbury8-Jun-20 15:04 
QuestionTranspose of a matrix Pin
Member 148492464-Jun-20 7:08
Member 148492464-Jun-20 7:08 
AnswerRe: Transpose of a matrix Pin
kalberts4-Jun-20 7:58
kalberts4-Jun-20 7:58 
AnswerRe: Transpose of a matrix Pin
CPallini4-Jun-20 20:25
mveCPallini4-Jun-20 20:25 
GeneralRe: Transpose of a matrix Pin
Member 148492464-Jun-20 23:52
Member 148492464-Jun-20 23:52 
GeneralRe: Transpose of a matrix Pin
CPallini5-Jun-20 0:04
mveCPallini5-Jun-20 0:04 
GeneralRe: Transpose of a matrix Pin
jeron15-Jun-20 4:53
jeron15-Jun-20 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.