Click here to Skip to main content
14,667,328 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Exercise Pin
Richard MacCutchan9-Jun-20 23:33
mveRichard MacCutchan9-Jun-20 23:33 
QuestionIs there any opensource version of telnet client library(encrypted) available for windows Pin
Member 147721178-Jun-20 2:25
MemberMember 147721178-Jun-20 2:25 
AnswerRe: Is there any opensource version of telnet client library(encrypted) available for windows Pin
Richard MacCutchan8-Jun-20 5:31
mveRichard MacCutchan8-Jun-20 5:31 
QuestionEfficient way to read/write file Pin
manoharbalu7-Jun-20 22:32
Membermanoharbalu7-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
Member 79891228-Jun-20 4:32
MemberMember 79891228-Jun-20 4:32 
AnswerRe: Efficient way to read/write file Pin
Joe Woodbury8-Jun-20 14:24
professionalJoe Woodbury8-Jun-20 14:24 
Putting aside the data storage constraints mentioned by others, you need to experiment.

1) Is the structure bitwise copyable?
2) If so, just write it to disk using CFile and measure the impact.
2a) Use LZ4 to compress the data first (My own guess is that this would make a difference with a hard drive, but may actually take more time with an SSD.)
3) If not, you will need to serialize it; I'd still keep all the data binary.
3a) You could serialize it to a block of memory and then write that in one go (very likely the fastest way)
3b) You could serialize to a file using CStdioFile (depending on the data, this could be very slow. Even slower if you used C++ iostreams.)
3c) Do a combination; Serialize the data in 32k chunks and write them, perhaps asynchronously. (That said, when doing anything comparable, I prefer just having a second thread write synchronously.)

If the data needs to be future proofed, consider serializing using RapidJSON (which is a very fast C++ JSON library), compressing the result with LZ4 and then writing that. However, this could easily take longer than a second, depending on what the data is.

Edit: If the data is fairly regular, you might be able to save the full thing every ten seconds and differences in between. This can be tricky; I once worked on an app which did this and I found that the differencing alone exceeded the time it took to transmit the data over TCP.
GeneralRe: Efficient way to read/write file Pin
Member 79891228-Jun-20 20:04
MemberMember 79891228-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
Member 79891229-Jun-20 3:54
MemberMember 79891229-Jun-20 3:54 
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
Membercharlieg11-Jun-20 11:53 
GeneralRe: Efficient way to read/write file Pin
Member 798912211-Jun-20 19:39
MemberMember 798912211-Jun-20 19:39 
GeneralRe: Efficient way to read/write file Pin
charlieg12-Jun-20 8:30
Membercharlieg12-Jun-20 8:30 
QuestionDoes WaitForSingleObject timeout after 49 days if INFINITE is passed? Pin
PrafullaVedante7-Jun-20 9:02
MemberPrafullaVedante7-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
MemberRedDk7-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
MemberPrafullaVedante8-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
MemberMember 148492464-Jun-20 7:08 
AnswerRe: Transpose of a matrix Pin
Member 79891224-Jun-20 7:58
MemberMember 79891224-Jun-20 7:58 
AnswerRe: Transpose of a matrix Pin
CPallini4-Jun-20 20:25
mveCPallini4-Jun-20 20:25 

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.