|
The only thing that I can think of, from Microsoft, on these lines is the CAB SDK[^]. But I see you are wanting to compress image files, so I do not know what good can cab compression do for you.
There is no standard way of creating a zip compressed file using MFC or Windows API. I believe the .NET framework has this feature though. There is also the LZMA SDK[^] which can compress to .7z format, if you'd like it. The compression would be better than zip (and even rar) and the library works like a charm.
Almost all compression utilities can extract from .7z files, so you don't have to possibly worry on the compatibility front too.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi Ashish,
Here you find good library for ZIP/UnZIP uitility.
It is just .cpp & .h files for ZIP & UnZIP utility.
This library is used in any c++ compiler (g++ linux, VC++ eVC++).
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
I am trying to cast an int pointer to double pointer, but conversion doesn´t work. I´ve tried c style casting and reinterpret_cast without success. Can anyone help me, please? For instance, how can I make ths work fine:
int a[]={1,2,3,4};
int* b;
double* c;
b=a;
c=(double*)b;
Thanks
|
|
|
|
|
Jorge wrote: how can I make ths work fine:
What does it mean, in your opinion?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am not sure what you mean.
|
|
|
|
|
The code is working fine, anyway it is not performing a conversion, it is interpreting the raw bits as a double.
You have the following string of bits (only the first two ints of the array matters):
1 2
00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000010
as a double it is
00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000010
^
0 as sign (first bit on the left), i.e. positive number
00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000010
^---------^
0 as exponent with in excess -1023 representation represents denormals when fraction is <> 0
(as in your case).
00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000010
^---------------------------------------------------------^
2^-20 + 2^-51 = 9,5367431685033920985006261616945e-7 as fraction
That gives, for a denormalized number
fraction * 2^-1021 = 4,2439915839068072135877506064327e-314
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Good stuff man, my 5.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks, anyway I'm quite sure there's some mistakes here and there...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hmm, it seems I got my reply. I still have the problem but this makes me afford it in a wiser manner. Thanks so much.
|
|
|
|
|
What do you mean by "conversion doesn't work"? There's actually no conversion that I can see. If you were wanting to convert the individual int elements of your int array to double , you should do that 'manually'. If you were just intending to change the pointer type, then there shouldn't be any difficulty:
int nArray[] = {1, 2, 3, 4};
double* pDouble = reinterpret_cast<double*>(nArray);
CString szStr;
szStr.Format(_T("%d %d"), *pDouble, *(pDouble+1));
AfxMessageBox(szStr);
Of course, I assume that you know what reinterpret_cast does.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi,
I am just trying to get a pointer to double from a pointer to int. That is what I mean by conversion. When you say 'manually' I actually dont know what you mean. I tried your code:
int nArray[] = {1, 2, 3, 4};
double* pDouble = reinterpret_cast<double*>(nArray);
but when I try to get *(pDouble(+i)) value(s) (for i=0,1,2,3) don´t get the expected 1.0,2.0,3.0,4.0
|
|
|
|
|
Have a closer look:
1. nArray is a an array of integers - the elements stored in the array are of 'int ' data type.
2. You create a pointer variable, which actually is supposed to point to a double , but you made it (you wanted that) to point to the beginning address of the integer array.
3. Now, it's just that the pointer type is double , but is pointing to an int array. You still have not converted the individual int elements in the array to double type.
4. If that's what you want, you can try %g in place of %d in the CString::Format() statement and see the results. (this way, you are just 'interpreting' an integer as a double, and you haven't converted any of the array elements from one datatype to another)
But please remember that the elements in the array are *still* int ones and if you want every element of the array to be of double data type, you must do the conversion yourself for every element of the array. Changing a pointer won't do that, quite obviously.
Am I clear enough?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thank you very much.You both helped me to see my real problem.
|
|
|
|
|
Hi Jorge,
Why don't you use union ?
For example you can take
union test
{
int a[4];
double c;
};
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
Hi Divyang,
thanks so much. That solves the problem but, I can not believe there´s no straight way to do it.
|
|
|
|
|
Hi ,
When i include any header file in a cpp file May i know why the syntax is #include "test.h" why not #include <test.h> .Please let me know the difference...
|
|
|
|
|
<> will search in the include search path.
"" will also search the current directory in addition to the include search path.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
See [^]. BTW read posting guidelines [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
which c++ book are you refering?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
My 5 .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
<> is for windows header files and "" for your header files.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi all,
if i m using this code in Visual studio 2005 than its working fine but in case of visual studio 2008 its gives and exeception that is::
Unhandled exception at 0x755e21b3 in test.exe: 0xC0000005: Access violation reading location 0x0000000c.
code is like that,
SHELLEXECUTEINFOA TempInfo = {0};
TempInfo.cbSize = sizeof(SHELLEXECUTEINFOA);
TempInfo.fMask = 0;
TempInfo.hwnd = NULL;
TempInfo.lpVerb = "open";
TempInfo.lpFile = "calc.exe";
TempInfo.lpParameters = "";
TempInfo.lpDirectory = "";
TempInfo.nShow = SW_NORMAL;
BOOL tt= ::ShellExecuteExA(&TempInfo);
if(tt==TRUE)
{
AfxMessageBox("ShellExecute created successfully");
}
else
{
AfxMessageBox("ShellExecute not created");
}
please help me this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
In Mumbai, we step through the code with the debugger to resolve such issues (if I remember it right, they do the same at Rome, but I'll leave it to Carlo to confirm).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
It's ok, but what do you do in Bangalore? (In Milan, I suppose, they ask to a Rome-based developer to do the job).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|