06-29-2018 10:18 AM
Hello,
I have read in the CVI documentation that the string maximum size is 2^31.
The problem is with realloc() function or with static normal declaration, the max size of a string I can have is 10 000 char. (from zero to 9999).
Is it normal ? I need to allocate much more then that for my app.
Any help please ?
Regards,
Solved! Go to Solution.
06-30-2018 05:54 AM - edited 06-30-2018 06:00 AM
Are you sure about that? I just tried this and it worked:
char *ddd; // test of malloc ddd = malloc (12000); memset (ddd, 0, 12000); ddd[10000] = 'A'; ddd[10001] = 'B'; ddd[10002] = 'C'; MessagePopup ("Test 1", ddd + 10000); // test of realloc ddd = realloc (ddd, 15000); memset (ddd + 12002, 0, 2998); ddd[14000] = 'D'; ddd[14001] = 'E'; ddd[14002] = 'F'; MessagePopup ("Test 2", ddd + 14000);
What you may be observing is that when looking at a char variable in Variables and Call Stack window you are limited to slices up to 10000 chars, but you may display whichever area you want within the string (e.g. a slice from 10000 to 11999 in my example above).
07-02-2018 04:55 AM
Hello Roberto,
Yes you are right.
The problem is not when allocation string memory but later in the code when executing it.
I explain : I'm reallocating and concatenating into an "sCmd" string like this :
"rar a -df [FileZipDestination] [FilePath1] [FilePath2] [FilePath3] [FilePath4] ........"
I have over 40 000 file path to set into this string (many files to compress).
The update of this string is good. And this works with 100 files for example.
But with 40 000 files, when I call "LaunchExecutable (sCmd)" to execute it I get error -19.
In the CVI help that means : "The operating system returned an unknown error code.".
Any Idea how to solve that please ?
Thanks in advance !
07-02-2018 06:49 AM - edited 07-02-2018 06:49 AM
So it appears the error, which seems related to the very long string you are passing to the command, can be either in LaunchExecutable or in rar.exe. Unfortunately I don't see any note in both commands on the maximum lenght of the string they accept.
A way may exist to simplify the situation if you can use wildcards in your command line; alternatively you could pass to rar a file with the list of files to be processed by the command instead of individual file names.
07-02-2018 07:55 AM
The FilesList.txt idea is a very good idea Roberto, thank you.
I did that, no error any more but .... I get this message in the cmd screen :
"RAR Trial version. Evaluation copy. Please register."
It seems that RAR command is not available for free for 100%.
Is there any other free command to replace it ?
07-05-2018 09:42 AM
Well I found a solution : I used 7z command. 7-ZIP is an LGPL licencing so no use limitation.
Thank you !