|
Hi Richard
I think because I am working on a EOL OS (XP) I have been having lots of problems installing Visual Studio 2010 I think the problems exist because the OS & the development of VStudio 2010 have not made any progress since its conception & I think that is why it is not working.
I have alternatively installed Code::Blocks with some minor glitchs & needing some additional files to run under XP but it seems to be working correctly.
I went for the portable install so that if it is no good for some reason I can easily ditch. Code::Blocks seems to have continuing development for XP so it has the advantage of update progression.
I will keep you posted re developments
Best Regards
|
|
|
|
|
Microsoft Visual C++ 2019. Windows 10, using MFC
Is there a nice step by step example of code showing how to use the MRU in a standard SDI application with ribbon and without document/view architecture?
My used files (*.jpg, *.bmp) are well stored in the MRU file list of the main menu of the ribbon.
But when I click on one of them I have an error in .../MFC/appui.cpp showing that ENSURE_VALID(m_pDocManager) failed, which is normal because I did not choose doc/view support.
Is there any way out, unless completely rewriting a new project with pDocManager?
Pierre
|
|
|
|
|
|
|
You are welcome!
|
|
|
|
|
Hi
I want the array of data under items, using this code i am able to get only the value under the first structure of data under items. How can i loop to the second structure of data under items, and further more if present. I am doing this using boost in c++.
Can someone help on this.
items=root.get_child("Serial");
for (boost::property_tree::ptree::iterator itprop = items.begin(); itprop != items.end(); ++itprop)
{
for(boost::property_tree::ptree::iterator it1=itprop->second.begin();it1!=itprop->second.end();++it1)
{
if(it1->first=="Items")
{
boost::property_tree::ptree& rootschild=it1->second;
cout<<"Size is "<<rootschild.size()<<"\n";
for(boost::property_tree::ptree::iterator="" it2="rootschild.begin();it2!=rootschild.end();++it2)
" {
="" it3="it2-">second.begin();it3!=it2->second. end();++it3)
{
std::cout<<it3->first<<": "<<it3->second.get_value<string>()<<"\n";
}
}
}
{
"Header": {
"Name": "abcd",
"Email": "xyz"
},
"Serial": [{
"flavour": "Green",
"Color": "9",
"code": "103",
"Items": [{
"date": "2020/11",
"value": "3.5",
"serial": "01"
}, {
"date": "2020/10",
"value": "3.4",
"serial": "03"
}]
}]
}
With Regards
|
|
|
|
|
What about something like:
serial_items = root.get_child("Serial");
items = serial_items.get_child("Items");
for (boost::property_tree::ptree::iterator itprop = items.begin(); itprop != items.end(); ++itprop)
... I don't use boost, nor have I tried to compile it, so this may or may not work.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 10-Jan-21 15:04pm.
|
|
|
|
|
Hi,
Thank you for the reply, but the code is crashing in the below line.
David Crow wrote: items = serial_items.get_child("Items");
With Regards
|
|
|
|
|
Litu Sahoo wrote: ...but the code is crashing in the below line. What exactly does that mean?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Litu Sahoo wrote: Thank you for the reply, but the code is crashing in the below line.
David Crow wrote: items = serial_items.get_child("Items");
Did you debug your code? What is the value of
serial_items
before the "crash"?
|
|
|
|
|
hi
m_data is showing blank and m_children is showing an address.
|
|
|
|
|
Hi
I modified the program but still not able to get the whole array of data Under Items. Below is the sample code. Please let me know where it is wrong.
namespace pt=boost::property_tree;
pt::ptree root;
pt::ptree items;
pt::ptree obsrvtns;
pt::ptree obsrvtns1;
pt::read_json(filepath,root);
obsrvtns=root.get_child("Header");
cout<<"Header size is "<<obsrvtns.size()<<"\n";
for="" (boost::property_tree::ptree::iterator="" itprop="obsrvtns.begin();" !="obsrvtns.end();" ++itprop)
="" {
="" cout<<itprop-="">first<<": "<<itprop->second.get_value<string>()<<"\n";
}
items=root.get_child("Serial");
cout<<"Series Size is "<<items.size()<<"\n";
for(boost::property_tree::ptree::iterator="" it="items.begin();it!=items.end();++it)
" {
="" cout<<"second="" size="" is="" "<<it-="">second.size()<<"\n";
for(boost::property_tree::ptree::iterator it1=it->second.begin();it1!=it->second.end();++it1)
{
cout<<it1->first<<": "<<it1->second.get_value<string>()<<"\n";
if(it1->first=="Item")
{
/*obsrvtns1=it1->second.get_child("Items");
cout<<"check \n";*/
//BOOST_FOREACH(boost::property_tree::ptree::value_type &v,root.get_child("Header.Serial.Item"))
BOOST_FOREACH(boost::property_tree::ptree::value_type &v,root.get_child("Item"))
{
cout<
|
|
|
|
|
Can someone help to give some tips? Why I compiled the program without error, yet it cannot open the notepad to see my text file : testedit.txt in the file folder c:\AHome. Thanks.
#include <stdio.h>
#include <stdlib.h>
void main()
{
system("cd C:\\Windows\\System32\notepad.exe c:\\AHome\testedit.txt ");
return 0;
}
|
|
|
|
|
Try:
system("C:\\Windows\\System32\\notepad.exe c:\\AHome\\testedit.txt ");
Mircea
|
|
|
|
|
Thanks for your reply ...
I have try ...
system("C:\\Windows\\System32\notepad.exe c:\\AHome\testedit.text ");
The error massage is :
'C:\Windows\System32' is not recognized as Internal or External Command, Operable Program or Batch file.
|
|
|
|
|
You missed a backslash just before notepad.exe. You don't even really need the entire path to Notepad.
This will work just fine:
system("notepad C:\\AHome\\testedit.text");
|
|
|
|
|
Make sure you're not doing that from an elevated process.
It's not quite DLL hijacking, but if an attacker could write a rogue notepad.exe into the %PATH% somewhere, they could then get your process to launch it with elevated privileges.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
True
|
|
|
|
|
Could you help me to understand what do you mean by " elevated process "?
|
|
|
|
|
|
Goh Kak Ng wrote: system("C:\Windows\System32\notepad.exe c:\AHome\testedit.text ");
You missed one backslash in the path. It must be:
system("C:\\Windows\\System32\\notepad.exe c:\\AHome\\testedit.text ");
|
|
|
|
|
Yes. You are right!
Try this work ...
system("C:\\Windows\\System32\\notepad.exe c:\\AHome\\testedit ");
Note that the test file name must be " testedit " and not " testedit.txt ". Otherwise, this file will not be found.
Thanks!
|
|
|
|
|
Goh Kak Ng wrote: ...yet it cannot open the notepad to see my text file : Aside from a few missing backslashes in the string literal, what's the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
He also seems to have a spurious "cd..." at the start of his string. I'd guess that's what's causing his grief but my crystal ball is foggy
Mircea
|
|
|
|
|
Thanks for your reply ...
cd is " change of directory " to C:\Windows\System32 where notepad.exe is located.
|
|
|
|