|
You need to clarify your question a bit.
First, please use the code block tags around your example code. Standard HTML does not render code properly
Secondly, you need to show the implementation (or a cut down version of it) of the get_m1 method
Thirdly, what is the problem that you are getting during m1.push_back ?
I'm not sure what you mean by a "reference vector of class objects".
Do you mean a vector of references to class objects? If you do then this will not compile since it is not possible to have a vector (or any other container) of references. The type for std::vector must be assignable[^], and references are not assignable. Use a vector of pointers to objects instead.
Or do you mean a reference to a vector of class objects? This is at least legal and should work, e.g.
class Piece
{
};
class Garment
{
public:
std::vector<Piece>& get_m1()
{
return pieces;
}
private:
std::vector<Piece> pieces;
};
static void foo()
{
Garment garment;
std::vector<Piece>& m1 = garment.get_m1();
Piece piece1;
m1.push_back(piece1);
}
Graham
Librarians rule, Ook!
|
|
|
|
|
Hi All.
I have a problem with opening an html file. The file is UTF-8 encoded.
My code is
ShellExecute(NULL, L"open", L"C:/PROGRAM FILES/MOZILLA FIREFOX/FIREFOX.EXE", L"file:///C:/DOCUME~1/MACADA~1/LOCALS~1/Temp/index.htm", NULL, SW_SHOWNORMAL);
it returns a value greater than 32 (success). But it opens a blank page.
When i look the page sources i can see that there is "Unicode conversion problem" is written in body tag.
If i try to open another file (ANSI encoded) it works properly.
Anyone have an idea?
Thanks,
Venera
|
|
|
|
|
What are your character encoding settings in FF? Have you tried IE with that file?
|
|
|
|
|
FF character encoding is set to Western but even setting to Unicode (UTF-8) does not help.
The same behavior is in IE.
|
|
|
|
|
OK, what happens when you open the file directly in FF or IE?
|
|
|
|
|
|
Have you tried without the "file:///"?
|
|
|
|
|
In this case it pops up an alert message "Firefox doesn't know how to open this address, because the protocol(c) isn't associated with any program".
|
|
|
|
|
I tried your code with the same syntax on several UTF-8 encoded files and it works fine for me.
|
|
|
|
|
Thanks.
I found a strange behaviour. When i put this file in D:, so the code is
ShellExecute(NULL, L"open", browser.c_str(), L"file:///D:/index.htm", NULL, SW_SHOWNORMAL);
it works. But i want to mention that when i try to open an ANSI encoded file from the same directory (C:/DOCUME~1/MACADA~1/LOCALS~1/Temp/) it also works fine. It is weird...
|
|
|
|
|
It appears that ShellExecute is working just fine. It's Firefox that is having a problem with the file.
|
|
|
|
|
I don't think it is FF problem because the problem occurs also in IE
|
|
|
|
|
Find, but it's still not a problem with ShellExecute.
|
|
|
|
|
venera_soft wrote: ShellExecute(NULL, L"open", L"C:/PROGRAM FILES/MOZILLA FIREFOX/FIREFOX.EXE", L"file:///C:/DOCUME~1/MACADA~1/LOCALS~1/Temp/index.htm", NULL, SW_SHOWNORMAL);
it returns a value greater than 32 (success). But it opens a blank page.
Can you execute this command outside of code (i.e., the Run box)?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
By typing C:/PROGRAM FILES/MOZILLA FIREFOX/FIREFOX.EXE C:/DOCUME~1/MACADA~1/LOCALS~1/Temp/index.htm in the Run box.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
No, it is impossible.
Thanks for your help. I found that the file was corrupting during the program run. And the reason was not the ShellExecute function.
|
|
|
|
|
venera_soft wrote: No, it is impossible.
That should tell you it's not a code issue.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
can n e one tell me how can i display any variable value or calulation result on the screen in form of message box or sort of like this....i m working in dialog base MFC application.
thanks.
|
|
|
|
|
Convert it to a string and display it. You might use CString::Format() , as you say you're using MFC.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Convert the result into a string using CString::Format .
The use the CString variable as the lpszText parameter of MessageBox .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Something like this ....
CString strTime;
strTime.Format("Time = %d", nMyTime);
AfxMessageBox(strTime);
.... Hope that helps
Ali
|
|
|
|
|
You may use CString::Format method [^] and then, for instance, AfxMessageBox function [^].
[added]
I'm a bit slow this morning...
[/added]
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]
|
|
|
|
|
CPallini wrote: I'm a bit slow this morning... Roll eyes
*Rajesh feeds the monkeys with genetically modified, steroid injected bananas*
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: *Rajesh feeds the monkeys with genetically modified, steroid injected bananas*
Slurp! May Carlo join Rajesh's monkey team?
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]
|
|
|
|