|
#include <vector>
#include <iostream>
using namespace std;
void step(unsigned int level, vector < vector <char> > & v, vector <char> & res);
void main()
{
vector< char > v1;
vector< char > v2;
vector< char > v3;
vector< char > v4;
vector< char > v5;
vector < vector < char > > v;
v1.push_back('a');v1.push_back('b');v1.push_back('c');
v2.push_back('d');v2.push_back('e');
v3.push_back('f');v3.push_back('g');v3.push_back('h');
v4.push_back('i');v4.push_back('j');v4.push_back('k');v4.push_back('l');
vector < char > res;
v.push_back(v1);v.push_back(v2);v.push_back(v3);v.push_back(v4);
res.resize(v.size());
step(0, v, res);
}
void step(unsigned int level, vector < vector <char> > & v, vector <char> & res)
{
for (unsigned int i=0; i<v[level].size(); i++)
{
res[level] = v[level][i];
if ( level == v.size()-1)
{
for (unsigned int k=0; k<res.size(); k++)
{
cout << res[k];
}
cout << endl;
}
else
{
step(level + 1, v, res);
}
}
}
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]
|
|
|
|
|
|
Hai!
In my application i have developed a code to draw an image from pixel data present in byte array. i get this byte array by reading an image file present in a location.
I was succesfully displaying (.png, .gif, .jpg, .bmp) but when i tried to display .j2k and .jp2 images using the same code my application displays blank or doesn't display image at all. I came to know that windows doesnot support .jp2 and .j2k images.
Now my doubt is if windows doesnot support them can i be able to display those (.jp2 and .j2k) images on my dialog (assuming i have correctly coded to display an image from byte array of a image file)?
Thanks!
|
|
|
|
|
|
Use CxImage[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Please help to create the machine certificate as I am working on AD RMS,I have installed the Virtual PC now I want to beging with coding in AD RMS project ........So I need to create Machine certificate and to have RAC..............
Help me Out ................
|
|
|
|
|
Hai!
My application creates an .jp2 image file, i am not able to display it on my dialog, so i thought of using a Image converter to convert this .jp2 image to .jpg image, as i am able to display .jpg images on my dialog.
So can you please suggest me any free converter and how to implement it in my application to convert .jp2 image to .jpg image.
I am developing my application in eVC++ for a WIN CE Device and using Pocket PC 2003 SDK.
Thanks!
|
|
|
|
|
CXImage article has good info about your question,you can find it on the Codeproject.
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 )
|
|
|
|
|
I have come across CXimage, But there are so many file (.cpp and .h) for each format of image, moreever i could not even know how to implement it, If you donot mind can you please explain me in detail which files of CXimage to be imported into my application and what code changes to be made so as to convert .jp2 image too .jpg, i need it very badly plz help me!
Thanks!
|
|
|
|
|
try image magik library, it's open source!
"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
|
|
|
|
|
Can you please explain in detail which file to be imported from Image magik and how to implement it in my application
Thanks!
|
|
|
|
|
have you checked out the imagemagik library? check it help, of you downloaded it sourece/com component!
"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
|
|
|
|
|
i declared the following code
class A
{
int i;
public:
void Showi()
{
i=10;
printf("\n i:%d ",i);
}
};
void main()
{
A *p= new A();
p->Showi();
if(p)
{
delete p;
printf("\n p deleted ");
}
p->Showi();
}
the problem is even after i deleted pointer p ..the call to Showi() works....does it mean p is deleted after sometime(since i heard VS 2005 uses GC)?
i am using VC++ 2005 express edition.
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
QuickDeveloper wrote: the problem is even after i deleted pointer p ..the call to Showi() works....does it mean p is deleted after sometime(since i heard VS 2005 uses GC)?
No, there's no such thing as garbage collector in C++. The fact that the call doesn't crash is probably pure luck (edit: see below). In fact you can always call a non virtual function on an object and the function will get called without problems (even if your object is NULL). The problem arise when you try to access data member of the class, in that case the troubles begin . If we take the example of the NULL pointer, an offset will be added to the address of the this pointer (NULL in that case) to be able to reach a specific member of the class. But the address is still invalid (NULL + an offset is still invalid).
In your case, what happened certainly is that when the function is called, the memory of your object has been released but as you didn't allocate any memory after that, the data is still in memory. Now, if you add some code to allocate memory just after the delete, it is possible that the memory used by your class previously will be overwritten by new data.
In fact, when you delete an object, it simply means that the memory is not protected anymore and that it can be reused for something else. If nobody is using it, it still contains the old data.
EDIT: in fact the call will never crash because even if the memory of your integer is overwritten, it can always be accessed without any problem. Of course, in that case you will end up with corrupted data.
|
|
|
|
|
Hi All,
I am trying to pass the values to managed code( C# ) to unmanaged code( C++ ). The following is the example code
[DllImport("Helper.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private extern static bool Sample(long AccessibleContext,long vm);
<p> </p>
long ac = 10;
long id = 20;
Sample(ac,id);
<p> </p>
EXTERN_C __declspec(dllexport) BOOL Sample( long ac ,long id)
{
long sa;
sa = ac + id;
return true;
}
I am not always getting the value of the second parameter (ie "id") in C++ code, it comes as 0 but i am getting the first parameter value.
How can i resolve this problem?
Thanks in advance.
|
|
|
|
|
I'm not familiar with C# domain, but I guess it is about calling convention problem.
About __stdcall or __cdecl.
C# maybe require __stdcall against C++ is just __cdecl.
Try C++ code like this;
EXTERN_C __declspec(dllexport) BOOL __stdcall Sample( long ac ,long id)
{
...
}
I'm not sure how to change C# declaration.
|
|
|
|
|
hello,
I have used CFont classes to change the fonts of strings and displayed the strings on screen but I am not able to gauge the exact coordinate where the next string will appear.
I have the legth of the stringg and the LOGFONT structure which stores the info of the Font but how do I find exact coordiantes depending upon the size of the string and LOGFONT info
Prithaa
|
|
|
|
|
Check out GetTextExtentPoint32()
--Mike--
Dunder-Mifflin, this is Pam.
|
|
|
|
|
Hello,
Thanks for your reply.
This seems to be an API function. Can I use it directly in my VC++ program?
Prithaa
|
|
|
|
|
Of course! If you're using MFC, there's probably a wrapper for it in the CDC class too.
--Mike--
Dunder-Mifflin, this is Pam.
|
|
|
|
|
Hello,
Thanks for your answers and quick replies.
I ll check the CDC class thouroughly but I just wanted to ask if it is possible to use an API directly within the program without bothering about the wrapper class.
Prithaa
|
|
|
|
|
Yes, of course you can.
If the name of a API function is the same of a MFC method, you've to use the global namespace operator :: in order to resolve name ambiguity, for instance:
CMyWnd::Foo()
{
::PostMessage(...);
}
this calls the Win32 PostMessage function instead of the CWnd::PostMessage method.
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 have created sample mfc executable files uisng MFC dialog based applications. i would to have single mfc executable file by combining all above mfc executable files in VC++. can i create single mfc exe using different mfc exes in new application.
whether this option is possible or not ?
In VB, this option can be done it seems
Jayalakshmi
|
|
|
|
|
Why you dont use of dlls files instead exe 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 )
|
|
|
|
|
I am afraid, you have to manually do that!
"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
|
|
|
|