Skip Items in CArchive |
Post Reply |
Author | |
barobax
Senior Member Joined: 07 May 2008 Status: Offline Points: 117 |
Post Options
Thanks(0)
Posted: 18 October 2008 at 3:15am |
Hi,
I have a serialized file and serialized 257244 strings in this file.I want to read string by index(i.e. Index 100 = "add"). I had a file with 200,000 integers and can read indexes by skip 4 bytes for each index(each Integer). I can skip and read Index 1000 with below code: int iSkip = (1000 - 1) * 4; TCHAR* sLoad = new TCHAR[iSkip]; archive.Read(sLoad, iSkip); free(sLoad); sLoad = NULL; delete sLoad; int iNum; archive >> iNum; if we use sizeof() in runtime we get 4 bytes for int and 4 bytes for string but I can't read string by skipping 4 bytes for each index.I fill the string with thousand characters and I use sizeof() in runtime and sizeof() return 4 bytes.I want to know how can I skip items or strings in CArchive ? I Ask(GOOGLE) from doctor for non-microsoft written archives and I found CArchiveEx for compressing serialized archives and set password for archives. I Read documents of codejock but I can not found a CArchive Extended class.CodeJock Extended CArchive class or not ? Please Help Me, Thanks in Advance, |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
If you serialize it like this:
ar << _1000characters;
ar << _1000characters;
Then you can simply use read:
char buffer[1000], buffer2[1000];
ar.Read(buffer, 1000);
ar.Read(buffer2, 1000);
If you use CString you must read the length first (4 bytes). Hmm, I really don't see your problem? |
|
barobax
Senior Member Joined: 07 May 2008 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Hi znakeeye,
Thanks in advance, I test it but don't work, My first strings are 1080 12-step when I skip 4 bytes and Carchive >> a string my string is empty and can't read 12-step !!!! Thanks znakeeye again for your help, |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
You can't skip simple CStrings.
Think its crazy idea to use CArchive for 300000 stings. Migrate to some database.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
barobax
Senior Member Joined: 07 May 2008 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Hi,
Thanks Oleg, I need a portable database. when I use Microsoft Access My Strings size is 90MB and when I export rows in text file My .txt file size is 50MB and when I compress it with WinRAR with Normal Compression in ZIP My Strings size is 10MB.now I need a portable database with compression feature and/or Encryption.If you(Oleg(the king of CodeJock)) have any Idea please tell me. Thanks from Oleg and znakeeye for responses to My Question. My work is URGENT.If you have any Idea(PLEASE) tell me. Thanks in Advance, Best Regards. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
barobax
Senior Member Joined: 07 May 2008 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Hi,
which strings we can skip ?!? Thanks for your database suggestion. Thanks, Best Regards. |
|
ABuenger
Newbie Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
|
Codejock support
|
|
ijwelch
Senior Member Joined: 20 June 2006 Status: Offline Points: 262 |
Post Options
Thanks(0)
|
barobax
Senior Member Joined: 07 May 2008 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Hi,
I found this in sqllites site. "This is a DLL of the SQLite library without the TCL bindings. The only external dependency is MSVCRT.DLL." it's very very portable. Thanks ABuenger & ijwelch for your help. Thanks All, Best Regards. |
|
barobax
Senior Member Joined: 07 May 2008 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
WOW ABuenger && ijwelch,
I work with SQL Lite today and it's nice. Thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanks, Best Regards, |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |