Print Page | Close Window

Skip Items in CArchive

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=12476
Printed Date: 26 June 2024 at 12:23pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Skip Items in CArchive
Posted By: barobax
Subject: Skip Items in CArchive
Date 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,



Replies:
Posted By: znakeeye
Date Posted: 19 October 2008 at 11:32am
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?


Posted By: barobax
Date Posted: 19 October 2008 at 3:24pm
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,



Posted By: Oleg
Date Posted: 20 October 2008 at 6:37am
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


Posted By: barobax
Date Posted: 20 October 2008 at 4:37pm
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.


Posted By: Oleg
Date Posted: 21 October 2008 at 2:08am

Hi,

try http://www.mysql.com/ - http://www.mysql.com/


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: barobax
Date Posted: 21 October 2008 at 5:12am
Hi,

Originally posted by oleg oleg wrote:

You can't skip simple CStrings.


which strings we can skip ?!?
Thanks for your database suggestion.

Thanks,
Best Regards.


Posted By: ABuenger
Date Posted: 21 October 2008 at 7:14am
Originally posted by oleg oleg wrote:

Hi,

try http://www.mysql.com/ - http://www.mysql.com/


Or better sqlite for embeddability.



-------------
Codejock support


Posted By: ijwelch
Date Posted: 21 October 2008 at 8:52am
SQLite com for anyone who needs it. And it's free.
http://www.thecommon.net/2.html



- -


Posted By: barobax
Date Posted: 21 October 2008 at 7:48pm
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.


Posted By: barobax
Date Posted: 30 October 2008 at 3:29pm
WOW ABuenger && ijwelch,
I work with SQL Lite today and it's nice.

Thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanks,
Best Regards,



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net