<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6818787173148484199</id><updated>2024-09-17T11:32:58.761+05:30</updated><category term="windows version"/><category term="32 bit"/><category term="64 bit"/><category term="Async registry monitor"/><category term="C++ code outlook"/><category term="Date time string"/><category term="Deprecated GetVersionEx"/><category term="ESENT metro style.USE ESENT on c#"/><category term="GMT +5:30"/><category term="GetVersionEx"/><category term="IXMLDOMDocument C++"/><category term="JET APIS"/><category term="JS"/><category term="Javascript"/><category term="Metro App"/><category term="Metro Style"/><category term="Metro Style App"/><category term="Metro Style database"/><category term="Monitor registry"/><category term="OS version C++"/><category term="Outllook view"/><category term="System TIME in c"/><category term="UserAgent"/><category term="VC++"/><category term="WIN 32 apis"/><category term="WIN8.1"/><category term="WINRT"/><category term="WIndows 8"/><category term="Windows 8.1"/><category term="XAML"/><category term="XML"/><category term="XML programming"/><category term="add custom clumn"/><category term="c#"/><category term="navigator.userAgent"/><category term="new field"/><category term="outlook inbox view code"/><category term="windows registry"/><title type='text'>Code in thoughts</title><subtitle type='html'>Coding is fun now......</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>28</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-1005628127824298133</id><published>2015-01-18T04:14:00.000+05:30</published><updated>2017-04-08T01:50:00.338+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Async registry monitor"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="Monitor registry"/><category scheme="http://www.blogger.com/atom/ns#" term="windows registry"/><title type='text'>Monitor Window Registry Key value change ashynchronously Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Here is sample code to monitor registry value change without hanging the thread.&lt;br /&gt;
&lt;br /&gt;
Its sample code so use properly.&lt;br /&gt;
&lt;br /&gt;
var g_DefaultTimeOutForRegMonitoring = 15000;&lt;br /&gt;
MonitoRegistryValue: function (szRegKeyVal, val) { // Key value path and value to watch&lt;br /&gt;
var intervalID;&lt;br /&gt;
var regKey = szRegKeyVal;&lt;br /&gt;
var value = val;&lt;br /&gt;
&lt;br /&gt;
intervalID = setInterval(function (regKey, value) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;try {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;var ret;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;ret = g_objRegUtil.ReadValueFromRegistry(szRegKeyVal);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ret == value)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Check ret value and make decision&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} catch (err) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
}, 5);&lt;br /&gt;
&lt;br /&gt;
// We will wait for certain time else break the watch&lt;br /&gt;
setTimeout(function () {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;clearInterval(intervalID);&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
}, g_DefaultTimeOutForRegMonitoring);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/1005628127824298133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/1005628127824298133' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1005628127824298133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1005628127824298133'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2015/01/monitor-window-registry-key-value.html' title='Monitor Window Registry Key value change ashynchronously Javascript'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-3427201435656085484</id><published>2015-01-18T04:01:00.000+05:30</published><updated>2015-01-18T04:01:07.592+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Deprecated GetVersionEx"/><category scheme="http://www.blogger.com/atom/ns#" term="GetVersionEx"/><category scheme="http://www.blogger.com/atom/ns#" term="OS version C++"/><category scheme="http://www.blogger.com/atom/ns#" term="WIN 32 apis"/><category scheme="http://www.blogger.com/atom/ns#" term="WIN8.1"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows 8.1"/><category scheme="http://www.blogger.com/atom/ns#" term="windows version"/><title type='text'>Get correct OS version on win 8.1 without using GetVesionEx API (deprecated )</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;NTSTATUS (WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;OSVERSIONINFOEXW osInfo;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;*(FARPROC*)&amp;amp;RtlGetVersion = GetProcAddress(GetModuleHandleA(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;ntdll&quot;&lt;/span&gt;), &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;RtlGetVersion&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; (NULL != RtlGetVersion)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &amp;nbsp;osInfo.dwOSVersionInfoSize = &lt;span style=&quot;color: blue;&quot;&gt;sizeof&lt;/span&gt;(osInfo);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &amp;nbsp;RtlGetVersion(&amp;amp;osInfo);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;



























&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: 9.5pt;&quot;&gt;Use above method on all&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;platform and it will work fine. Where GetOSVersionEx API&amp;nbsp;deprecated&amp;nbsp;by MS and&amp;nbsp;gives wrong result on WIN 8.1.&lt;/span&gt;&lt;span style=&quot;font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: 9.5pt;&quot;&gt;Tested above sample on XP to 8,1 and works for me.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: 9.5pt;&quot;&gt;There is another&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;alternative of manifest to use GetOSversionEx.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;Source:&lt;a href=&quot;http://web3.codeproject.com/Articles/678668/Part-Overcoming-Windows-s&quot; target=&quot;_blank&quot;&gt; CodeProject&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/3427201435656085484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/3427201435656085484' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3427201435656085484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3427201435656085484'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2015/01/get-correct-os-version-on-win-81.html' title='Get correct OS version on win 8.1 without using GetVesionEx API (deprecated )'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-1164375705165634539</id><published>2014-12-03T06:55:00.001+05:30</published><updated>2014-12-03T06:55:13.063+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="32 bit"/><category scheme="http://www.blogger.com/atom/ns#" term="64 bit"/><category scheme="http://www.blogger.com/atom/ns#" term="JS"/><category scheme="http://www.blogger.com/atom/ns#" term="navigator.userAgent"/><category scheme="http://www.blogger.com/atom/ns#" term="UserAgent"/><category scheme="http://www.blogger.com/atom/ns#" term="windows version"/><title type='text'>Using Java Script detect if OS is 64 bit version or 32 bit.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Use following html code to show OS version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
function onload()&lt;br /&gt;
{&lt;br /&gt;
if (navigator.userAgent.indexOf(&quot;WOW64&quot;) != -1 || navigator.userAgent.indexOf(&quot;Win64&quot;) != -1 )&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp;alert(&quot;64 bit&quot;);&lt;br /&gt;
} else {&lt;br /&gt;
&amp;nbsp; &amp;nbsp;alert(&quot;32 bit&quot;);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;body onload=&quot;onload()&quot; scrolling=&quot;no&quot;&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ref:&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms537503%28v=vs.85%29.aspx&quot;&gt;UserAgent&lt;/a&gt;&amp;nbsp;(http://msdn.microsoft.com/en-us/library/ms537503%28v=vs.85%29.aspx)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/1164375705165634539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/1164375705165634539' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1164375705165634539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1164375705165634539'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2014/12/using-java-script-detect-if-os-is-64.html' title='Using Java Script detect if OS is 64 bit version or 32 bit.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-5239999370987209737</id><published>2012-10-26T19:09:00.001+05:30</published><updated>2012-10-26T19:09:41.279+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="Metro Style"/><category scheme="http://www.blogger.com/atom/ns#" term="XAML"/><title type='text'>Hide poup when click outside.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Just set &lt;strong&gt;islightdismissenabled &lt;/strong&gt;property true for control. If popup is enabled and user clicks any where else the popup will be automatically disappeared.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/5239999370987209737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/5239999370987209737' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/5239999370987209737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/5239999370987209737'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2012/10/hide-poup-when-click-outside.html' title='Hide poup when click outside.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-6540869031932496139</id><published>2012-10-03T13:32:00.000+05:30</published><updated>2012-10-03T13:34:55.037+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Metro App"/><category scheme="http://www.blogger.com/atom/ns#" term="Metro Style App"/><category scheme="http://www.blogger.com/atom/ns#" term="WIndows 8"/><category scheme="http://www.blogger.com/atom/ns#" term="WINRT"/><title type='text'>error MSB3271: There was a mismatch between the processor architecture of the project being built &quot;MSIL&quot; and the processor architecture, &quot;x86&quot;, of the implementation file</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The error comes when you include winrt component in your project. To remove the error open project file of both the components and change the value of $(Platform)&#39;== to make common in both project. I came out with error after changing the value from AnyCPU to x86.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/6540869031932496139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/6540869031932496139' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/6540869031932496139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/6540869031932496139'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2012/10/error-msb3271-there-was-mismatch.html' title='error MSB3271: There was a mismatch between the processor architecture of the project being built &quot;MSIL&quot; and the processor architecture, &quot;x86&quot;, of the implementation file'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-6918049324502386020</id><published>2012-09-28T00:04:00.000+05:30</published><updated>2012-10-09T15:43:30.168+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ESENT metro style.USE ESENT on c#"/><category scheme="http://www.blogger.com/atom/ns#" term="JET APIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Metro Style database"/><category scheme="http://www.blogger.com/atom/ns#" term="VC++"/><title type='text'>ESENT –JET APIs to create database in Metro Style App on Windows 8</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
ESENT –JET APIs to create database in Metro Style App on
Windows 8-&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
ESENT dll is a part of windows SDK and provides apis to
create and manage database on metro style application there is two major choices
that can be used to implement databse in metro style application:&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l2 level1 lfo1; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;1.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;SqlLite v3&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l2 level1 lfo1; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;2.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;ESENT – JET database model&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
SQLLite3 is not officially annouced to be used as database
engine on windows8. But winrt version is already available to play with
database.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
ESENT is already the part of windows8 so winrt support is
already their to link esentlib statically to use the application.&amp;nbsp; JET apis are much flexible to create indexed
base database and can be used to create huge database with thousands of table
and columns.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
JET apis introduced in different levels according to
plateform like win2000, WINXP , VISTA and above.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Most of structures changed due to unicode support and
security enhancement. I have created database using esent &amp;nbsp;- JET apis to work on metro style application
the following example will demonstrate the steps to create database using
native JET APIS.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Created a c ++ winrt component that will introduce classes
and methods to work with database. This component can be used in metro style
application created using any language like vc++ or c#.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The winrt component project will cretae .winmd file that
will be added as referance to othe projects to call databse methods.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In given samle I have worked to provide basic functionality
that can be used in metro style application to play with database:&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l3 level1 lfo2; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;1.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Initiating ESENT JET database engine&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l3 level1 lfo2; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;2.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Creation of database and table column&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l3 level1 lfo2; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;3.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Attach already created database and access table
information and related details.&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l3 level1 lfo2; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;4.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Insertion of records &lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l3 level1 lfo2; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;5.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Deletion of records from database.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Use following steps to create winrt component in VS:&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l0 level1 lfo3; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;1.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Create winrt project from template list&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l0 level1 lfo3; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;2.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Link the project with esent.dll&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l0 level1 lfo3; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;3.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;And use sample code to start with database.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Use the winrt component in metro app written in c#&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l1 level1 lfo4; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;1.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Add referance-&amp;gt;locate the .winmd file and
add.&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l1 level1 lfo4; text-indent: -0.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;2.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Use the namespace and class in your project and
go with it.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
//JetDatabasecomponent.cpp&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/6918049324502386020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/6918049324502386020' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/6918049324502386020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/6918049324502386020'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2012/09/esent-jet-apis-to-create-database-in.html' title='ESENT –JET APIs to create database in Metro Style App on Windows 8'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-3008575095951969869</id><published>2011-06-28T12:53:00.000+05:30</published><updated>2011-06-28T13:04:33.198+05:30</updated><title type='text'>C# - Programmatically Reset IP configuration to default</title><content type='html'>Following sample code will reset Internet Protocol version 4(Tcp/Ipv4) Properties to &lt;br /&gt;Obtain an IP address automatically and Obtain DNS server automatically&lt;br /&gt;&lt;br /&gt;private void RunCommand(String commandLineArgs)&lt;br /&gt;        {&lt;br /&gt;            System.Diagnostics.Process objProcess = new System.Diagnostics.Process();&lt;br /&gt;            objProcess.StartInfo.FileName = &quot;C:\\Windows\\System32\\cmd.exe&quot;;&lt;br /&gt;            //objProcess.StartInfo.UseShellExecute = false;&lt;br /&gt;            objProcess.StartInfo.Arguments = commandLineArgs;&lt;br /&gt;            objProcess.StartInfo.CreateNoWindow = false; &lt;br /&gt;            if (objProcess.StartInfo.Arguments.Length &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                objProcess.Start();&lt;br /&gt;                do&lt;br /&gt;                {&lt;br /&gt;                    Thread.Sleep(100);&lt;br /&gt;                } while (!objProcess.HasExited);&lt;br /&gt;            }&lt;br /&gt;            if (objProcess.ExitCode == 0)&lt;br /&gt;                MessageBox.Show(&quot;Installed successfully.....&quot;);&lt;br /&gt;            else&lt;br /&gt;                MessageBox.Show(&quot;Oops smthng missed :( please try again........&quot;);&lt;br /&gt;            objProcess.Close();             &lt;br /&gt;        }&lt;br /&gt;        private void button1_Click(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            RunCommand(&quot;/c netsh interface ip set address \&quot;Local Area Connection\&quot; dhcp&quot;);&lt;br /&gt;            RunCommand(&quot;/c netsh interface ip set DNS \&quot;Local Area Connection\&quot; dhcp&quot;); &lt;br /&gt;        }</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/3008575095951969869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/3008575095951969869' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3008575095951969869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3008575095951969869'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2011/06/c-programmatically-reset-ip.html' title='C# - Programmatically Reset IP configuration to default'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-3467548458657221466</id><published>2010-12-10T10:53:00.001+05:30</published><updated>2010-12-10T10:53:40.479+05:30</updated><title type='text'>Earn money Online free</title><content type='html'>&lt;a href=&quot;http://www.PaisaLive.com/register.asp?394944-7854514&quot;&gt;&lt;b&gt;&lt;font color=&quot;#FF0000&quot; size=&quot;4&quot;&gt;Earn upto Rs. 9,000 pm checking Emails. Join now!&lt;/font&gt;&lt;/b&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/3467548458657221466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/3467548458657221466' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3467548458657221466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3467548458657221466'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2010/12/earn-money-online-free.html' title='Earn money Online free'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-1222905657192850668</id><published>2010-12-02T16:39:00.000+05:30</published><updated>2010-12-02T16:42:24.582+05:30</updated><title type='text'>taskdef class org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs cannot be found</title><content type='html'>I got this problem while building JAR.&lt;br /&gt;I have spent 10 to 15 to solve this headech steps wre:&lt;br /&gt;Right click over the Project and select option -&gt; Resolve Reference Problem....&lt;br /&gt;Then It will display which reference is really problem just locate the right Libraries.&lt;br /&gt;And tan tada done :)....&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Best of Luck...</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/1222905657192850668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/1222905657192850668' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1222905657192850668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1222905657192850668'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2010/12/taskdef-class-orgnetbeansmodulesjavaj2s.html' title='taskdef class org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs cannot be found'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-224895945639170696</id><published>2010-07-01T12:01:00.000+05:30</published><updated>2010-07-01T12:03:46.307+05:30</updated><title type='text'>Example Code to send mail in JAVA</title><content type='html'>package javaapplication27;&lt;br /&gt;import java.security.Security;&lt;br /&gt;import java.util.Properties;&lt;br /&gt;&lt;br /&gt;import javax.mail.Message;&lt;br /&gt;import javax.mail.PasswordAuthentication;&lt;br /&gt;import javax.mail.Session;&lt;br /&gt;import javax.mail.Transport;&lt;br /&gt;import javax.mail.internet.InternetAddress;&lt;br /&gt;import javax.mail.internet.MimeMessage;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author SANAT&lt;br /&gt; */&lt;br /&gt;public class Main {&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * @param args the command line arguments&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;   private String mailhost = &quot;smtp.gmail.com&quot;;&lt;br /&gt;&lt;br /&gt; public synchronized void sendMail(String subject, String body, String sender, String recipients)&lt;br /&gt;                       throws Exception&lt;br /&gt; {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;  Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());&lt;br /&gt;&lt;br /&gt;  Properties props = new Properties();&lt;br /&gt;  props.setProperty(&quot;mail.transport.protocol&quot;, &quot;smtp&quot;);&lt;br /&gt;  props.setProperty(&quot;mail.host&quot;, mailhost);&lt;br /&gt;  props.put(&quot;mail.smtp.auth&quot;, &quot;true&quot;);&lt;br /&gt;  props.put(&quot;mail.smtp.port&quot;, &quot;465&quot;);&lt;br /&gt;  props.put(&quot;mail.smtp.socketFactory.port&quot;, &quot;465&quot;);&lt;br /&gt;  props.put(&quot;mail.smtp.socketFactory.class&quot;,&lt;br /&gt;  &quot;javax.net.ssl.SSLSocketFactory&quot;);&lt;br /&gt;  props.put(&quot;mail.smtp.socketFactory.fallback&quot;, &quot;false&quot;);&lt;br /&gt;  props.setProperty(&quot;mail.smtp.quitwait&quot;, &quot;false&quot;);&lt;br /&gt;&lt;br /&gt;  Session session = Session.getDefaultInstance(props,&lt;br /&gt;    new javax.mail.Authenticator()&lt;br /&gt;  {&lt;br /&gt;   protected PasswordAuthentication getPasswordAuthentication()&lt;br /&gt;   { return new PasswordAuthentication(&quot;USER&quot;,&quot;PASS&quot;); }&lt;br /&gt;  });&lt;br /&gt;&lt;br /&gt;  MimeMessage message = new MimeMessage(session);&lt;br /&gt;  message.setSender(new InternetAddress(sender));&lt;br /&gt;  message.setSubject(subject);&lt;br /&gt;  message.setContent(body, &quot;text/plain&quot;);&lt;br /&gt;  if (recipients.indexOf(&#39;,&#39;) &gt; 0)&lt;br /&gt;     message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients));&lt;br /&gt;  else&lt;br /&gt;     message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  Transport.send(message);&lt;br /&gt;            }&lt;br /&gt;            catch(Exception ex)&lt;br /&gt;            {&lt;br /&gt;                ex.printStackTrace();&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; public static void main(String args[]) throws Exception&lt;br /&gt; {&lt;br /&gt;  Main mailutils = new Main();&lt;br /&gt;  mailutils.sendMail(&quot;Test&quot;, &quot;dl;fkglkdjgjdlkgjlk;djglkdlkgjdlkgjlkdjglkfdj&quot;, &quot;TO@gmail.com&quot;, &quot;FROM@GMAIL.com&quot;);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        // TODO code application logic here&lt;br /&gt;}</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/224895945639170696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/224895945639170696' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/224895945639170696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/224895945639170696'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2010/06/example-code-to-send-mail-in-java.html' title='Example Code to send mail in JAVA'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-5780688449968718659</id><published>2010-04-28T22:41:00.000+05:30</published><updated>2010-04-28T22:51:41.073+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="IXMLDOMDocument C++"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><category scheme="http://www.blogger.com/atom/ns#" term="XML programming"/><title type='text'>XML Programming using IXMLDOMDOCUMENT in vc++</title><content type='html'>Here the sample code to start XML programming using XML dom parser.&lt;br /&gt;&lt;br /&gt;// TestXML1.cpp : Defines the entry point for the console application.&lt;br /&gt;//&lt;br /&gt;#import&lt;msxml2.dll&gt;&lt;br /&gt;#include &quot;stdafx.h&quot;&lt;br /&gt;#include&lt;msxml.h&gt;&lt;br /&gt;#include&lt;atlbase.h&gt;&lt;br /&gt;#include&lt;objbase.h&gt;&lt;br /&gt;//sample xml u can copy paste it in note pad and save it with .xml extension and store in location c:\&lt;br /&gt;&lt;br /&gt;&lt;!-- &lt;?xml version=&quot;1.0&quot; ?&gt;&lt;br /&gt;&lt;catalog&gt;&lt;br /&gt;  &lt;cd&gt;&lt;br /&gt;    &lt;title&gt;Empire Burlesque&lt;/title&gt;&lt;br /&gt;    &lt;artist&gt;Bob Dylan&lt;/artist&gt;&lt;br /&gt;    &lt;country&gt;USA&lt;/country&gt;&lt;br /&gt;    &lt;company&gt;Columbia&lt;/company&gt;&lt;br /&gt;    &lt;price&gt;10.90&lt;/price&gt;&lt;br /&gt;    &lt;year&gt;1985&lt;/year&gt;&lt;br /&gt;  &lt;/cd&gt;&lt;br /&gt;&lt;/catalog&gt;&lt;br /&gt;--&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int _tmain(int argc, _TCHAR* argv[])&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt;  CoInitialize (NULL);&lt;br /&gt; &lt;br /&gt;  CComPtr&lt; IXMLDOMDocument  &gt; pXMlDoc = NULL;   &lt;br /&gt;  HRESULT hr = CoCreateInstance(__uuidof(DOMDocument), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&amp;pXMlDoc));&lt;br /&gt;  VARIANT_BOOL  boolval;&lt;br /&gt;  CComVariant path =&quot;c:\\cdcat.xml&quot;;&lt;br /&gt;  hr = pXMlDoc-&gt;load(path,&amp;boolval);&lt;br /&gt;  BSTR val ;&lt;br /&gt;  pXMlDoc-&gt;get_xml(&amp;val);&lt;br /&gt;  MessageBox(0,val,_T(&quot;TEST&quot;),0); &lt;br /&gt;  pXMlDoc = NULL;&lt;br /&gt;&lt;br /&gt;  CoUninitialize();&lt;br /&gt;  return 0;&lt;br /&gt;}</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/5780688449968718659/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/5780688449968718659' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/5780688449968718659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/5780688449968718659'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2010/04/xml-programming-using-ixmldomdocument.html' title='XML Programming using IXMLDOMDOCUMENT in vc++'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-8232762203802715322</id><published>2010-03-11T11:41:00.000+05:30</published><updated>2010-03-11T11:46:44.434+05:30</updated><title type='text'>Good collection of C n C++ interview written Questions and answers</title><content type='html'>Download Questions in PDF :&lt;a href=&quot;https://docs.google.com/viewer?a=v&amp;pid=gmail&amp;attid=0.1&amp;thid=1273d8851062b38b&amp;mt=application%2Fpdf&amp;url=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3D2%26ik%3D4fbd6844e3%26view%3Datt%26th%3D1273d8851062b38b%26attid%3D0.1%26disp%3Dattd%26realattid%3Df_g6j6ti920%26zw&amp;sig=AHIEtbRs5KNWQTLFagp5O_Qk-rRLYGMh8Q&amp;pli=1&quot;&gt;Download C n c++ written questions and Ans(PDF)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;C Aptitude&lt;br /&gt;1. void main()&lt;br /&gt;int const * p=5;&lt;br /&gt;printf(&quot;%d&quot;,++(*p));&lt;br /&gt;Answer:&lt;br /&gt;Compiler error: Cannot modify a constant value.&lt;br /&gt;Explanation:&lt;br /&gt;p is a pointer to a &quot;constant integer&quot;. But we tried to change the value of the &quot;constant integer&quot;.&lt;br /&gt;2. main()&lt;br /&gt;char s[ ]=&quot;man&quot;;&lt;br /&gt;int i;&lt;br /&gt;for(i=0;s[ i ];i++)&lt;br /&gt;printf(&quot;\n%c%c%c%c&quot;,s[ i ],*(s+i),*(i+s),i[s]);&lt;br /&gt;Answer:&lt;br /&gt;mmmm&lt;br /&gt;aaaa&lt;br /&gt;nnnn&lt;br /&gt;Explanation:&lt;br /&gt;s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally array&lt;br /&gt;name is the base address for that array. Here s is the base address. i is the index number/displacement from the&lt;br /&gt;base address. So, indirecting it with * is same as s[i]. i[s] may be surprising. But in the case of C it is same as&lt;br /&gt;3. main()&lt;br /&gt;float me = 1.1;&lt;br /&gt;double you = 1.1;&lt;br /&gt;if(me==you)&lt;br /&gt;printf(&quot;I love U&quot;);&lt;br /&gt;else&lt;br /&gt;printf(&quot;I hate U&quot;);&lt;br /&gt;Answer:&lt;br /&gt;I hate U&lt;br /&gt;Explanation:&lt;br /&gt;For floating point numbers (float, double, long double) the values cannot be predicted exactly.&lt;br /&gt;Depending on the number of bytes, the precession with of the value represented varies. Float takes 4 bytes and&lt;br /&gt;long double takes 10 bytes. So float stores 0.9 with less precision than long double.&lt;br /&gt;Rule of Thumb:&lt;br /&gt;Never compare or at-least be cautious when using floating point numbers with relational&lt;br /&gt;operators (== , &gt;, &lt;, &lt;=, &gt;=,!= ) .&lt;br /&gt;4. main()&lt;br /&gt;{&lt;br /&gt;static int var = 5;&lt;br /&gt;printf(&quot;%d &quot;,var--);&lt;br /&gt;if(var)&lt;br /&gt;main();&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;54321&lt;br /&gt;Explanation:&lt;br /&gt;When static storage class is given, it is initialized once. The change in the value of a static&lt;br /&gt;variable is retained even between the function calls. Main is also treated like any other ordinary function,&lt;br /&gt;which can be called recursively.&lt;br /&gt;5. main()&lt;br /&gt;int c[ ]={2.8,3.4,4,6.7,5};&lt;br /&gt;int j,*p=c,*q=c;&lt;br /&gt;for(j=0;j&lt;5;j++) {&lt;br /&gt;printf(&quot; %d &quot;,*c);&lt;br /&gt;++q;&lt;br /&gt;}&lt;br /&gt;for(j=0;j&lt;5;j++){&lt;br /&gt;printf(&quot; %d &quot;,*p);&lt;br /&gt;++p;&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;2222223465&lt;br /&gt;Explanation:&lt;br /&gt;Initially pointer c is assigned to both p and q. In the first loop, since only q is incremented and&lt;br /&gt;not c , the value 2 will be printed 5 times. In second loop p itself is incremented. So the values 2 3 4 6 5 will be&lt;br /&gt;printed.&lt;br /&gt;6. main()&lt;br /&gt;extern int i;&lt;br /&gt;i=20;&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;Answer:&lt;br /&gt;Linker Error : Undefined symbol &#39;_i&#39;&lt;br /&gt;Explanation:&lt;br /&gt;extern storage class in the following declaration,&lt;br /&gt;extern int i;&lt;br /&gt;specifies to the compiler that the memory for i is allocated in some other program and that address will be&lt;br /&gt;given to the current program at the time of linking. But linker finds that no other variable of name i is available&lt;br /&gt;in any other program with memory space allocated for it. Hence a linker error has occurred .&lt;br /&gt;7. main()&lt;br /&gt;int i=-1,j=-1,k=0,l=2,m;&lt;br /&gt;m=i++&amp;&amp;j++&amp;&amp;k++||l++;&lt;br /&gt;printf(&quot;%d %d %d %d %d&quot;,i,j,k,l,m);&lt;br /&gt;Answer:&lt;br /&gt;00131&lt;br /&gt;2 Explanation :&lt;br /&gt;Logical operations always give a result of 1 or 0 . And also the logical AND (&amp;&amp;) operator&lt;br /&gt;has higher priority over the logical OR (||) operator. So the expression ‘i++ &amp;&amp; j++ &amp;&amp; k++’ is executed&lt;br /&gt;first. The result of this expression is 0 (-1 &amp;&amp; -1 &amp;&amp; 0 = 0). Now the expression is 0 || 2 which evaluates to 1&lt;br /&gt;(because OR operator always gives 1 except for ‘0 || 0’ combination- for which it gives 0). So the value of m is&lt;br /&gt;1. The values of other variables are also incremented by 1.&lt;br /&gt;8. main()&lt;br /&gt;char *p;&lt;br /&gt;printf(&quot;%d %d &quot;,sizeof(*p),sizeof(p));&lt;br /&gt;Answer:&lt;br /&gt;12&lt;br /&gt;Explanation:&lt;br /&gt;The sizeof() operator gives the number of bytes taken by its operand. P is a character pointer,&lt;br /&gt;which needs one byte for storing its value (a character). Hence sizeof(*p) gives a value of 1. Since it needs two&lt;br /&gt;bytes to store the address of the character pointer sizeof(p) gives 2.&lt;br /&gt;9. main()&lt;br /&gt;int i=3;&lt;br /&gt;switch(i)&lt;br /&gt;{&lt;br /&gt;default:printf(&quot;zero&quot;);&lt;br /&gt;case 1: printf(&quot;one&quot;);&lt;br /&gt;break;&lt;br /&gt;case 2:printf(&quot;two&quot;);&lt;br /&gt;break;&lt;br /&gt;case 3: printf(&quot;three&quot;);&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;Answer :&lt;br /&gt;three&lt;br /&gt;Explanation :&lt;br /&gt;The default case can be placed anywhere inside the loop. It is executed only when all other&lt;br /&gt;cases doesn&#39;t match.&lt;br /&gt;10. main()&lt;br /&gt;printf(&quot;%x&quot;,-1&lt;&lt;4);&lt;br /&gt;Answer:&lt;br /&gt;fff0&lt;br /&gt;Explanation :&lt;br /&gt;-1 is internally represented as all 1&#39;s. When left shifted four times the least significant 4 bits are&lt;br /&gt;filled with 0&#39;s.The %x format specifier specifies that the integer value be printed as a hexadecimal value.&lt;br /&gt;11. main()&lt;br /&gt;char string[]=&quot;Hello World&quot;;&lt;br /&gt;3 display(string);&lt;br /&gt;void display(char *string)&lt;br /&gt;printf(&quot;%s&quot;,string);&lt;br /&gt;Answer:&lt;br /&gt;Compiler Error : Type mismatch in redeclaration of function display&lt;br /&gt;Explanation :&lt;br /&gt;In third line, when the function display is encountered, the compiler doesn&#39;t know anything&lt;br /&gt;about the function display. It assumes the arguments and return types to be integers, (which is the default type).&lt;br /&gt;When it sees the actual function display, the arguments and type contradicts with what it has assumed&lt;br /&gt;previously. Hence a compile time error occurs.&lt;br /&gt;12. main()&lt;br /&gt;int c=- -2;&lt;br /&gt;printf(&quot;c=%d&quot;,c);&lt;br /&gt;Answer:&lt;br /&gt;c=2;&lt;br /&gt;Explanation:&lt;br /&gt;Here unary minus (or negation) operator is used twice. Same maths rules applies, ie. minus *&lt;br /&gt;minus= plus.&lt;br /&gt;Note:&lt;br /&gt;However you cannot give like --2. Because -- operator can only be applied to variables as a&lt;br /&gt;decrement operator (eg., i--). 2 is a constant and not a variable.&lt;br /&gt;13. #define int char&lt;br /&gt;main()&lt;br /&gt;int i=65;&lt;br /&gt;printf(&quot;sizeof(i)=%d&quot;,sizeof(i));&lt;br /&gt;Answer:&lt;br /&gt;sizeof(i)=1&lt;br /&gt;Explanation:&lt;br /&gt;Since the #define replaces the string int by the macro char&lt;br /&gt;14. main()&lt;br /&gt;int i=10;&lt;br /&gt;i=!i&gt;14;&lt;br /&gt;printf(&quot;i=%d&quot;,i);&lt;br /&gt;Answer:&lt;br /&gt;i=0&lt;br /&gt;Explanation:&lt;br /&gt;In the expression !i&gt;14 , NOT (!) operator has more precedence than ‘ &gt;’ symbol. ! is a unary&lt;br /&gt;logical operator. !i (!10) is 0 (not of true is false). 0&gt;14 is false (zero).&lt;br /&gt;15. #include&lt;stdio.h&gt;&lt;br /&gt;4&lt;br /&gt;main()&lt;br /&gt;char s[]={&#39;a&#39;,&#39;b&#39;,&#39;c&#39;,&#39;\n&#39;,&#39;c&#39;,&#39;\0&#39;};&lt;br /&gt;char *p,*str,*str1;&lt;br /&gt;p=&amp;s[3];&lt;br /&gt;str=p;&lt;br /&gt;str1=s;&lt;br /&gt;printf(&quot;%d&quot;,++*p + ++*str1-32);&lt;br /&gt;Answer:&lt;br /&gt;77&lt;br /&gt;Explanation:&lt;br /&gt;p is pointing to character &#39;\n&#39;. str1 is pointing to character &#39;a&#39; ++*p. &quot;p is pointing to &#39;\n&#39; and that is&lt;br /&gt;incremented by one.&quot; the ASCII value of &#39;\n&#39; is 10, which is then incremented to 11. The value of ++*p is 11.&lt;br /&gt;++*str1, str1 is pointing to &#39;a&#39; that is incremented by 1 and it becomes &#39;b&#39;. ASCII value of &#39;b&#39; is 98.&lt;br /&gt;Now performing (11 + 98 – 32), we get 77(&quot;M&quot;);&lt;br /&gt;So we get the output 77 :: &quot;M&quot; (Ascii is 77).&lt;br /&gt;16. #include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };&lt;br /&gt;int *p,*q;&lt;br /&gt;p=&amp;a[2][2][2];&lt;br /&gt;*q=***a;&lt;br /&gt;printf(&quot;%d----%d&quot;,*p,*q);&lt;br /&gt;Answer:&lt;br /&gt;SomeGarbageValue---1&lt;br /&gt;Explanation:&lt;br /&gt;p=&amp;a[2][2][2] you declare only two 2D arrays, but you are trying to access the third&lt;br /&gt;2D(which you are not declared) it will print garbage values. *q=***a starting address of a is assigned integer&lt;br /&gt;pointer. Now q is pointing to starting address of a. If you print *q, it will print first element of 3D array.&lt;br /&gt;17. #include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;struct xx&lt;br /&gt;{&lt;br /&gt;int x=3;&lt;br /&gt;char name[]=&quot;hello&quot;;&lt;br /&gt;};&lt;br /&gt;struct xx *s;&lt;br /&gt;printf(&quot;%d&quot;,s-&gt;x);&lt;br /&gt;printf(&quot;%s&quot;,s-&gt;name);&lt;br /&gt;Answer:&lt;br /&gt;Compiler Error&lt;br /&gt;Explanation:&lt;br /&gt;You should not initialize variables in declaration&lt;br /&gt;18. #include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;5&lt;br /&gt;struct xx&lt;br /&gt;{&lt;br /&gt;int x;&lt;br /&gt;struct yy&lt;br /&gt;{&lt;br /&gt;char s;&lt;br /&gt;struct xx *p;&lt;br /&gt;};&lt;br /&gt;struct yy *q;&lt;br /&gt;};&lt;br /&gt;Answer:&lt;br /&gt;Compiler Error&lt;br /&gt;Explanation:&lt;br /&gt;The structure yy is nested within structure xx. Hence, the elements are of yy are to be accessed&lt;br /&gt;through the instance of structure xx, which needs an instance of yy to be known. If the instance is created after&lt;br /&gt;defining the structure the compiler will not know about the instance relative to xx. Hence for nested structure&lt;br /&gt;yy you have to declare member.&lt;br /&gt;19. main()&lt;br /&gt;printf(&quot;\nab&quot;);&lt;br /&gt;printf(&quot;\bsi&quot;);&lt;br /&gt;printf(&quot;\rha&quot;);&lt;br /&gt;Answer:&lt;br /&gt;hai&lt;br /&gt;Explanation:&lt;br /&gt;\n - newline&lt;br /&gt;\b - backspace&lt;br /&gt;\r - linefeed&lt;br /&gt;20. main()&lt;br /&gt;int i=5;&lt;br /&gt;printf(&quot;%d%d%d%d%d%d&quot;,i++,i--,++i,--i,i);&lt;br /&gt;Answer:&lt;br /&gt;45545&lt;br /&gt;Explanation:&lt;br /&gt;The arguments in a function call are pushed into the stack from left to right. The evaluation is&lt;br /&gt;by popping out from the stack. and the evaluation is from right to left, hence the result.&lt;br /&gt;21. #define square(x) x*x&lt;br /&gt;main()&lt;br /&gt;int i;&lt;br /&gt;i = 64/square(4);&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;Answer:&lt;br /&gt;64&lt;br /&gt;6&lt;br /&gt;Explanation:&lt;br /&gt;the macro call square(4) will substituted by 4*4 so the expression becomes i = 64/4*4 . Since /&lt;br /&gt;and * has equal priority the expression will be evaluated as (64/4)*4 i.e. 16*4 = 64&lt;br /&gt;22. main()&lt;br /&gt;char *p=&quot;hai friends&quot;,*p1;&lt;br /&gt;p1=p;&lt;br /&gt;while(*p!=&#39;\0&#39;) ++*p++;&lt;br /&gt;printf(&quot;%s %s&quot;,p,p1);&lt;br /&gt;Answer:&lt;br /&gt;ibj!gsjfoet&lt;br /&gt;Explanation:&lt;br /&gt;++*p++ will be parse in the given order&lt;br /&gt; *p that is value at the location currently pointed by p will be taken&lt;br /&gt; ++*p the retrieved value will be incremented&lt;br /&gt; when ; is encountered the location will be incremented that is p++ will be executed&lt;br /&gt;Hence, in the while loop initial value pointed by p is ‘h’, which is changed to ‘i’ by executing ++*p and pointer&lt;br /&gt;moves to point, ‘a’ which is similarly changed to ‘b’ and so on. Similarly blank space is converted to ‘!’. Thus,&lt;br /&gt;we obtain value in p becomes “ibj!gsjfoet” and since p reaches ‘\0’ and p1 points to p thus p1doesnot print&lt;br /&gt;anything.&lt;br /&gt;23. #include &lt;stdio.h&gt;&lt;br /&gt;#define a 10&lt;br /&gt;main()&lt;br /&gt;#define a 50&lt;br /&gt;printf(&quot;%d&quot;,a);&lt;br /&gt;Answer:&lt;br /&gt;50&lt;br /&gt;Explanation:&lt;br /&gt;The preprocessor directives can be redefined anywhere in the program. So the most recently&lt;br /&gt;assigned value will be taken.&lt;br /&gt;24. #define clrscr() 100&lt;br /&gt;main()&lt;br /&gt;clrscr();&lt;br /&gt;printf(&quot;%d\n&quot;,clrscr());&lt;br /&gt;Answer:&lt;br /&gt;100&lt;br /&gt;Explanation:&lt;br /&gt;Preprocessor executes as a seperate pass before the execution of the compiler. So textual&lt;br /&gt;replacement of clrscr() to 100 occurs.The input program to compiler looks like this :&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;100;&lt;br /&gt;printf(&quot;%d\n&quot;,100);&lt;br /&gt;}&lt;br /&gt;7 Note:&lt;br /&gt;100; is an executable statement but with no action. So it doesn&#39;t give any problem&lt;br /&gt;25. main()&lt;br /&gt;printf(&quot;%p&quot;,main);&lt;br /&gt;Answer:&lt;br /&gt;Some address will be printed.&lt;br /&gt;Explanation:&lt;br /&gt;Function names are just addresses (just like array names are addresses).&lt;br /&gt;main() is also a function. So the address of function main will be printed. %p in printf specifies that the&lt;br /&gt;argument is an address. They are printed as hexadecimal numbers.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;clrscr();&lt;br /&gt;}&lt;br /&gt;clrscr();&lt;br /&gt;Answer:&lt;br /&gt;No output/error&lt;br /&gt;Explanation:&lt;br /&gt;The first clrscr() occurs inside a function. So it becomes a function call. In the second clrscr();&lt;br /&gt;is a function declaration (because it is not inside any function).&lt;br /&gt;enum colors {BLACK,BLUE,GREEN}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;printf(&quot;%d..%d..%d&quot;,BLACK,BLUE,GREEN);&lt;br /&gt;return(1);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;0..1..2&lt;br /&gt;Explanation:&lt;br /&gt;enum assigns numbers starting from 0, if not explicitly defined.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;char far *farther,*farthest;&lt;br /&gt;printf(&quot;%d..%d&quot;,sizeof(farther),sizeof(farthest));&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;4..2&lt;br /&gt;Explanation:&lt;br /&gt;the second pointer is of char type and not a far pointer&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;8 int i=400,j=300;&lt;br /&gt;printf(&quot;%d..%d&quot;);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;400..300&lt;br /&gt;Explanation:&lt;br /&gt;printf takes the values of the first two assignments of the program. Any number of printf&#39;s may&lt;br /&gt;be given. All of them take only the first two values. If more number of assignments given in&lt;br /&gt;the program,then printf will take garbage values.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char *p;&lt;br /&gt;p=&quot;Hello&quot;;&lt;br /&gt;printf(&quot;%c\n&quot;,*&amp;*p);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;H&lt;br /&gt;Explanation:&lt;br /&gt;* is a dereference operator &amp; is a reference operator. They can be applied any number of&lt;br /&gt;times provided it is meaningful. Here p points to the first character in the string &quot;Hello&quot;. *p&lt;br /&gt;dereferences it and so its value is H. Again &amp; references it to an address and * dereferences it&lt;br /&gt;to the value H.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=1;&lt;br /&gt;while (i&lt;=5)&lt;br /&gt;{&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;if (i&gt;2)&lt;br /&gt;goto here;&lt;br /&gt;i++;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;fun()&lt;br /&gt;{&lt;br /&gt;here:&lt;br /&gt;printf(&quot;PP&quot;);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error: Undefined label &#39;here&#39; in function main&lt;br /&gt;Explanation:&lt;br /&gt;Labels have functions scope, in other words The scope of the labels is limited to functions .&lt;br /&gt;The label &#39;here&#39; is available in function fun() Hence it is not visible in function main.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;static char names[5][20]={&quot;pascal&quot;,&quot;ada&quot;,&quot;cobol&quot;,&quot;fortran&quot;,&quot;perl&quot;};&lt;br /&gt;int i;&lt;br /&gt;char *t;&lt;br /&gt;t=names[3];&lt;br /&gt;names[3]=names[4];&lt;br /&gt;9 names[4]=t;&lt;br /&gt;for (i=0;i&lt;=4;i++)&lt;br /&gt;printf(&quot;%s&quot;,names[i]);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error: Lvalue required in function main&lt;br /&gt;Explanation:&lt;br /&gt;Array names are pointer constants. So it cannot be modified.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int i=5;&lt;br /&gt;printf(&quot;%d&quot;,i++ + ++i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Output Cannot be predicted exactly.&lt;br /&gt;Explanation:&lt;br /&gt;Side effects are involved in the evaluation of i&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int i=5;&lt;br /&gt;printf(&quot;%d&quot;,i+++++i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler Error&lt;br /&gt;Explanation:&lt;br /&gt;The expression i+++++i is parsed as i ++ ++ + i which is an illegal combination of operators.&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=1,j=2;&lt;br /&gt;switch(i)&lt;br /&gt;{&lt;br /&gt;case 1: printf(&quot;GOOD&quot;);&lt;br /&gt;break;&lt;br /&gt;case j: printf(&quot;BAD&quot;);&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler Error: Constant expression required in function main.&lt;br /&gt;Explanation:&lt;br /&gt;The case statement can have only constant expressions (this implies that we cannot use&lt;br /&gt;variable names directly so an error).&lt;br /&gt;Note:&lt;br /&gt;Enumerated types can be used in case statements.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i;&lt;br /&gt;printf(&quot;%d&quot;,scanf(&quot;%d&quot;,&amp;i)); // value 10 is given as input here&lt;br /&gt;}&lt;br /&gt;10&lt;br /&gt;Answer:&lt;br /&gt;1&lt;br /&gt;Explanation:&lt;br /&gt;Scanf returns number of items successfully read and not 1/0. Here 10 is given as input which&lt;br /&gt;should have been scanned successfully. So number of items read is 1.&lt;br /&gt;#define f(g,g2) g##g2&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int var12=100;&lt;br /&gt;printf(&quot;%d&quot;,f(var,12));&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;100&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=0;&lt;br /&gt;for(;i++;printf(&quot;%d&quot;,i)) ;&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;1&lt;br /&gt;Explanation:&lt;br /&gt;before entering into the for loop the checking condition is &quot;evaluated&quot;. Here it evaluates to 0&lt;br /&gt;(false) and comes out of the loop, and i is incremented (note the semicolon after the for loop).&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char s[]={&#39;a&#39;,&#39;b&#39;,&#39;c&#39;,&#39;\n&#39;,&#39;c&#39;,&#39;\0&#39;};&lt;br /&gt;char *p,*str,*str1;&lt;br /&gt;p=&amp;s[3];&lt;br /&gt;str=p;&lt;br /&gt;str1=s;&lt;br /&gt;printf(&quot;%d&quot;,++*p + ++*str1-32);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;M&lt;br /&gt;Explanation:&lt;br /&gt;p is pointing to character &#39;\n&#39;.str1 is pointing to character &#39;a&#39; ++*p meAnswer:&quot;p is pointing to&lt;br /&gt;&#39;\n&#39; and that is incremented by one.&quot; the ASCII value of &#39;\n&#39; is 10. then it is incremented to 11.&lt;br /&gt;the value of ++*p is 11. ++*str1 meAnswer:&quot;str1 is pointing to &#39;a&#39; that is incremented by 1 and&lt;br /&gt;it becomes &#39;b&#39;. ASCII value of &#39;b&#39; is 98. both 11 and 98 is added and result is subtracted from&lt;br /&gt;32.&lt;br /&gt;i.e. (11+98-32)=77(&quot;M&quot;);&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;struct xx&lt;br /&gt;11 {&lt;br /&gt;int x=3;&lt;br /&gt;char name[]=&quot;hello&quot;;&lt;br /&gt;};&lt;br /&gt;struct xx *s=malloc(sizeof(struct xx));&lt;br /&gt;printf(&quot;%d&quot;,s-&gt;x);&lt;br /&gt;printf(&quot;%s&quot;,s-&gt;name);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler Error&lt;br /&gt;Explanation:&lt;br /&gt;Initialization should not be done for structure members inside the structure declaration&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;struct xx&lt;br /&gt;{&lt;br /&gt;int x;&lt;br /&gt;struct yy&lt;br /&gt;{&lt;br /&gt;char s;&lt;br /&gt;struct xx *p;&lt;br /&gt;};&lt;br /&gt;struct yy *q;&lt;br /&gt;};&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler Error&lt;br /&gt;Explanation:&lt;br /&gt;in the end of nested structure yy a member have to be declared.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;extern int i;&lt;br /&gt;i=20;&lt;br /&gt;printf(&quot;%d&quot;,sizeof(i));&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Linker error: undefined symbol &#39;_i&#39;.&lt;br /&gt;Explanation:&lt;br /&gt;extern declaration specifies that the variable i is defined somewhere else. The compiler passes&lt;br /&gt;the external variable to be resolved by the linker. So compiler doesn&#39;t find an error. During&lt;br /&gt;linking the linker searches for the definition of i. Since it is not found the linker flags an error.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;printf(&quot;%d&quot;, out);&lt;br /&gt;}&lt;br /&gt;int out=100;&lt;br /&gt;Answer:&lt;br /&gt;Compiler error: undefined symbol out in function main.&lt;br /&gt;Explanation:&lt;br /&gt;12&lt;br /&gt;The rule is that a variable is available for use from the point of declaration. Even though a is a&lt;br /&gt;global variable, it is not available for main. Hence an error.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;extern out;&lt;br /&gt;printf(&quot;%d&quot;, out);&lt;br /&gt;}&lt;br /&gt;int out=100;&lt;br /&gt;Answer:&lt;br /&gt;100&lt;br /&gt;Explanation:&lt;br /&gt;This is the correct way of writing the previous program.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;show();&lt;br /&gt;}&lt;br /&gt;void show()&lt;br /&gt;{&lt;br /&gt;printf(&quot;I&#39;m the greatest&quot;);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compier error: Type mismatch in redeclaration of show.&lt;br /&gt;Explanation:&lt;br /&gt;When the compiler sees the function show it doesn&#39;t know anything about it. So the default&lt;br /&gt;return type (ie, int) is assumed. But when compiler sees the actual definition of show mismatch&lt;br /&gt;occurs since it is declared as void. Hence the error.&lt;br /&gt;The solutions are as follows:&lt;br /&gt;1. declare void show() in main() .&lt;br /&gt;2. define show() before main().&lt;br /&gt;3. declare extern void show() before the use of show().&lt;br /&gt;main( )&lt;br /&gt;{&lt;br /&gt;int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};&lt;br /&gt;printf(“%u %u %u %d \n”,a,*a,**a,***a);&lt;br /&gt;printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;100, 100, 100, 2&lt;br /&gt;114, 104, 102, 3&lt;br /&gt;Explanation:&lt;br /&gt;The given array is a 3-D one. It can also be viewed as a 1-D array.&lt;br /&gt;2 4&lt;br /&gt;7&lt;br /&gt;8&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;2&lt;br /&gt;2&lt;br /&gt;2&lt;br /&gt;100 102 104 106 108 110 112 114 116 118 120 122&lt;br /&gt;thus, for the first printf statement a, *a, **a give address of first element . since the&lt;br /&gt;indirection ***a gives the value. Hence, the first line of the output.&lt;br /&gt;for the second printf a+1 increases in the third dimension thus points to value at 114, *a+1&lt;br /&gt;increments in second dimension thus points to 104, **a +1 increments the first dimension thus&lt;br /&gt;13&lt;br /&gt;points to 102 and ***a+1 first gets the value at first location and then increments it by 1.&lt;br /&gt;Hence, the output.&lt;br /&gt;main( )&lt;br /&gt;{&lt;br /&gt;int a[ ] = {10,20,30,40,50},j,*p;&lt;br /&gt;for(j=0; j&lt;5; j++)&lt;br /&gt;{&lt;br /&gt;printf(“%d” ,*a);&lt;br /&gt;a++;&lt;br /&gt;}&lt;br /&gt;p = a;&lt;br /&gt;for(j=0; j&lt;5; j++)&lt;br /&gt;{&lt;br /&gt;printf(“%d ” ,*p);&lt;br /&gt;p++;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error: lvalue required.&lt;br /&gt;Explanation:&lt;br /&gt;Error is in line with statement a++. The operand must be an lvalue and may be of any of scalar&lt;br /&gt;type for the any operator, array name only when subscripted is an lvalue. Simply array name is&lt;br /&gt;a non-modifiable lvalue.&lt;br /&gt;main( )&lt;br /&gt;{&lt;br /&gt;static int a[ ] = {0,1,2,3,4};&lt;br /&gt;int *p[ ] = {a,a+1,a+2,a+3,a+4};&lt;br /&gt;int **ptr = p;&lt;br /&gt;ptr++;&lt;br /&gt;printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);&lt;br /&gt;*ptr++;&lt;br /&gt;printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);&lt;br /&gt;*++ptr;&lt;br /&gt;printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);&lt;br /&gt;++*ptr;&lt;br /&gt;printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;111&lt;br /&gt;222&lt;br /&gt;333&lt;br /&gt;344&lt;br /&gt;Explanation:&lt;br /&gt;Let us consider the array and the two pointers with some address&lt;br /&gt;0&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;100&lt;br /&gt;102&lt;br /&gt;104&lt;br /&gt;106&lt;br /&gt;108&lt;br /&gt;100&lt;br /&gt;102&lt;br /&gt;104&lt;br /&gt;106&lt;br /&gt;1000 1002 1004 1006 1008&lt;br /&gt;14&lt;br /&gt;ptr&lt;br /&gt;1000&lt;br /&gt;2000&lt;br /&gt;After execution of the instruction ptr++ value in ptr becomes 1002, if scaling factor for integer&lt;br /&gt;is 2 bytes. Now ptr – p is value in ptr – starting location of array p, (1002 – 1000) / (scaling&lt;br /&gt;factor) = 1, *ptr – a = value at address pointed by ptr – starting value of array a, 1002 has a&lt;br /&gt;value 102 so the value is (102 – 100)/(scaling factor) = 1, **ptr is the value stored in the&lt;br /&gt;location pointed by the pointer of ptr = value pointed by value pointed by 1002 = value&lt;br /&gt;pointed by 102 = 1. Hence the output of the firs printf is 1, 1, 1.&lt;br /&gt;After execution of *ptr++ increments value of the value in ptr by scaling factor, so it&lt;br /&gt;becomes1004. Hence, the outputs for the second printf are ptr – p = 2, *ptr – a = 2, **ptr = 2.&lt;br /&gt;After execution of *++ptr increments value of the value in ptr by scaling factor, so it&lt;br /&gt;becomes1004. Hence, the outputs for the third printf are ptr – p = 3, *ptr – a = 3, **ptr = 3.&lt;br /&gt;After execution of ++*ptr value in ptr remains the same, the value pointed by the value is&lt;br /&gt;incremented by the scaling factor. So the value in array p at location 1006 changes from 106&lt;br /&gt;10 108,. Hence, the outputs for the fourth printf are ptr – p = 1006 – 1000 = 3, *ptr – a = 108 –&lt;br /&gt;100 = 4, **ptr = 4.&lt;br /&gt;main( )&lt;br /&gt;{&lt;br /&gt;char *q;&lt;br /&gt;int j;&lt;br /&gt;for (j=0; j&lt;3; j++) scanf(“%s” ,(q+j));&lt;br /&gt;for (j=0; j&lt;3; j++) printf(“%c” ,*(q+j));&lt;br /&gt;for (j=0; j&lt;3; j++) printf(“%s” ,(q+j));&lt;br /&gt;}&lt;br /&gt;Explanation:&lt;br /&gt;Here we have only one pointer to type char and since we take input in the same pointer thus&lt;br /&gt;we keep writing over in the same location, each time shifting the pointer value by 1. Suppose&lt;br /&gt;the inputs are MOUSE, TRACK and VIRTUAL. Then for the first input suppose the pointer&lt;br /&gt;starts at location 100 then the input one is stored as&lt;br /&gt;M&lt;br /&gt;O&lt;br /&gt;U&lt;br /&gt;S&lt;br /&gt;E&lt;br /&gt;\0&lt;br /&gt;When the second input is given the pointer is incremented as j value becomes 1, so the input is&lt;br /&gt;filled in memory starting from 101.&lt;br /&gt;M&lt;br /&gt;T&lt;br /&gt;R&lt;br /&gt;A&lt;br /&gt;C&lt;br /&gt;K&lt;br /&gt;\0&lt;br /&gt;The third input starts filling from the location 102&lt;br /&gt;M&lt;br /&gt;T&lt;br /&gt;V&lt;br /&gt;I&lt;br /&gt;R&lt;br /&gt;T&lt;br /&gt;This is the final value stored .&lt;br /&gt;The first printf prints the values at the position q, q+1 and q+2 = M T V&lt;br /&gt;The second printf prints three strings starting from locations q, q+1, q+2&lt;br /&gt;i.e MTVIRTUAL, TVIRTUAL and VIRTUAL.&lt;br /&gt;main( )&lt;br /&gt;{&lt;br /&gt;void *vp;&lt;br /&gt;char ch = ‘g’, *cp = “goofy”;&lt;br /&gt;int j = 20;&lt;br /&gt;vp = &amp;ch;&lt;br /&gt;printf(“%c”, *(char *)vp);&lt;br /&gt;vp = &amp;j;&lt;br /&gt;printf(“%d”,*(int *)vp);&lt;br /&gt;vp = cp;&lt;br /&gt;15&lt;br /&gt;printf(“%s”,(char *)vp + 3);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;g20fy&lt;br /&gt;Explanation:&lt;br /&gt;Since a void pointer is used it can be type casted to any other type pointer. vp = &amp;ch stores&lt;br /&gt;address of char ch and the next statement prints the value stored in vp after type casting it to&lt;br /&gt;the proper data type pointer. the output is ‘g’. Similarly the output from second printf is ‘20’.&lt;br /&gt;The third printf statement type casts it to print the string from the 4 th value hence the output is&lt;br /&gt;‘fy’.&lt;br /&gt;main ( )&lt;br /&gt;{&lt;br /&gt;static char *s[ ] = {“black”, “white”, “yellow”, “violet”};&lt;br /&gt;char **ptr[ ] = {s+3, s+2, s+1, s}, ***p;&lt;br /&gt;p = ptr;&lt;br /&gt;**++p;&lt;br /&gt;printf(“%s”,*--*++p + 3);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;ck&lt;br /&gt;Explanation:&lt;br /&gt;In this problem we have an array of char pointers pointing to start of 4 strings. Then we have&lt;br /&gt;ptr which is a pointer to a pointer of type char and a variable p which is a pointer to a pointer&lt;br /&gt;to a pointer of type char. p hold the initial value of ptr, i.e. p = s+3. The next statement&lt;br /&gt;increment value in p by 1 , thus now value of p = s+2. In the printf statement the expression is&lt;br /&gt;evaluated *++p causes gets value s+1 then the pre decrement is executed and we get s+1 – 1 =&lt;br /&gt;s . the indirection operator now gets the value from the array of s and adds 3 to the starting&lt;br /&gt;address. The string is printed starting from this position. Thus, the output is ‘ck’.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i, n;&lt;br /&gt;char *x = “girl”;&lt;br /&gt;n = strlen(x);&lt;br /&gt;*x = x[n];&lt;br /&gt;for(i=0; i&lt;n; ++i)&lt;br /&gt;{&lt;br /&gt;printf(“%s\n”,x);&lt;br /&gt;x++;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;(blank space)&lt;br /&gt;irl&lt;br /&gt;rl&lt;br /&gt;l&lt;br /&gt;Explanation:&lt;br /&gt;Here a string (a pointer to char) is initialized with a value “girl”. The strlen function returns&lt;br /&gt;the length of the string, thus n has a value 4. The next statement assigns value at the nth&lt;br /&gt;location (‘\0’) to the first location. Now the string becomes “\0irl” . Now the printf statement&lt;br /&gt;prints the string after each iteration it increments it starting position. Loop starts from 0 to 4.&lt;br /&gt;16&lt;br /&gt;The first time x[0] = ‘\0’ hence it prints nothing and pointer value is incremented. The second&lt;br /&gt;time it prints from x[1] i.e “irl” and the third time it prints “rl” and the last time it prints “l”&lt;br /&gt;and the loop terminates.&lt;br /&gt;int i,j;&lt;br /&gt;for(i=0;i&lt;=10;i++)&lt;br /&gt;{&lt;br /&gt;j+=5;&lt;br /&gt;assert(i&lt;5);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Runtime error: Abnormal program termination.&lt;br /&gt;assert failed (i&lt;5), &lt;file name&gt;,&lt;line number&gt;&lt;br /&gt;Explanation:&lt;br /&gt;asserts are used during debugging to make sure that certain conditions are satisfied. If assertion&lt;br /&gt;fails, the program will terminate reporting the same. After debugging use,&lt;br /&gt;#undef NDEBUG&lt;br /&gt;and this will disable all the assertions from the source code. Assertion&lt;br /&gt;is a good debugging tool to make use of.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=-1;&lt;br /&gt;+i;&lt;br /&gt;printf(&quot;i = %d, +i = %d \n&quot;,i,+i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;i = -1, +i = -1&lt;br /&gt;Explanation:&lt;br /&gt;Unary + is the only dummy operator in C. Where-ever it comes you can just ignore it just&lt;br /&gt;because it has no effect in the expressions (hence the name dummy operator).&lt;br /&gt;What are the files which are automatically opened when a C file is executed?&lt;br /&gt;Answer:&lt;br /&gt;stdin, stdout, stderr (standard input,standard output,standard error).&lt;br /&gt;57) what will be the position of the file marker?&lt;br /&gt;a: fseek(ptr,0,SEEK_SET);&lt;br /&gt;b: fseek(ptr,0,SEEK_CUR);&lt;br /&gt;Answer :&lt;br /&gt;a: The SEEK_SET sets the file position marker to the starting of the file.&lt;br /&gt;b: The SEEK_CUR sets the file position marker to the current position&lt;br /&gt;of the file.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char name[10],s[12];&lt;br /&gt;scanf(&quot; \&quot;%[^\&quot;]\&quot;&quot;,s);&lt;br /&gt;}&lt;br /&gt;How scanf will execute?&lt;br /&gt;Answer:&lt;br /&gt;First it checks for the leading white space and discards it.Then it matches with a quotation&lt;br /&gt;mark and then it reads all character upto another quotation mark.&lt;br /&gt;17&lt;br /&gt;What is the problem with the following code segment?&lt;br /&gt;while ((fgets(receiving array,50,file_ptr)) != EOF)&lt;br /&gt;;&lt;br /&gt;Answer &amp; Explanation:&lt;br /&gt;fgets returns a pointer. So the correct end of file check is checking for != NULL.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;main();&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Runtime error : Stack overflow.&lt;br /&gt;Explanation:&lt;br /&gt;main function calls itself again and again. Each time the function is called its return address is&lt;br /&gt;stored in the call stack. Since there is no condition to terminate the function call, the call stack&lt;br /&gt;overflows at runtime. So it terminates the program and results in an error.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char *cptr,c;&lt;br /&gt;void *vptr,v;&lt;br /&gt;c=10; v=0;&lt;br /&gt;cptr=&amp;c; vptr=&amp;v;&lt;br /&gt;printf(&quot;%c%v&quot;,c,v);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error (at line number 4): size of v is Unknown.&lt;br /&gt;Explanation:&lt;br /&gt;You can create a variable of type void * but not of type void, since void is an empty type. In&lt;br /&gt;the second line you are creating variable vptr of type void * and v of type void hence an error.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char *str1=&quot;abcd&quot;;&lt;br /&gt;char str2[]=&quot;abcd&quot;;&lt;br /&gt;printf(&quot;%d %d %d&quot;,sizeof(str1),sizeof(str2),sizeof(&quot;abcd&quot;));&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;255&lt;br /&gt;Explanation:&lt;br /&gt;In first sizeof, str1 is a character pointer so it gives you the size of the pointer variable. In&lt;br /&gt;second sizeof the name str2 indicates the name of the array whose size is 5 (including the &#39;\0&#39;&lt;br /&gt;termination character). The third sizeof is similar to the second one.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char not;&lt;br /&gt;not=!2;&lt;br /&gt;printf(&quot;%d&quot;,not);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;0&lt;br /&gt;18&lt;br /&gt;Explanation:&lt;br /&gt;! is a logical operator. In C the value 0 is considered to be the boolean value FALSE, and any&lt;br /&gt;non-zero value is considered to be the boolean value TRUE. Here 2 is a non-zero value so&lt;br /&gt;TRUE. !TRUE is FALSE (0) so it prints 0.&lt;br /&gt;#define FALSE -1&lt;br /&gt;#define TRUE 1&lt;br /&gt;#define NULL 0&lt;br /&gt;main() {&lt;br /&gt;if(NULL)&lt;br /&gt;puts(&quot;NULL&quot;);&lt;br /&gt;else if(FALSE)&lt;br /&gt;puts(&quot;TRUE&quot;);&lt;br /&gt;else&lt;br /&gt;puts(&quot;FALSE&quot;);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;TRUE&lt;br /&gt;Explanation:&lt;br /&gt;The input program to the compiler after processing by the preprocessor is,&lt;br /&gt;main(){&lt;br /&gt;if(0)&lt;br /&gt;puts(&quot;NULL&quot;);&lt;br /&gt;else if(-1)&lt;br /&gt;puts(&quot;TRUE&quot;);&lt;br /&gt;else&lt;br /&gt;puts(&quot;FALSE&quot;);&lt;br /&gt;}&lt;br /&gt;Preprocessor doesn&#39;t replace the values given inside the double quotes. The check by if&lt;br /&gt;condition is boolean value false so it goes to else. In second if -1 is boolean value true hence&lt;br /&gt;&quot;TRUE&quot; is printed.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int k=1;&lt;br /&gt;printf(&quot;%d==1 is &quot;&quot;%s&quot;,k,k==1?&quot;TRUE&quot;:&quot;FALSE&quot;);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;1==1 is TRUE&lt;br /&gt;Explanation:&lt;br /&gt;When two strings are placed together (or separated by white-space) they are concatenated (this&lt;br /&gt;is called as &quot;stringization&quot; operation). So the string is as if it is given as &quot;%d==1 is %s&quot;. The&lt;br /&gt;conditional operator( ?: ) evaluates to &quot;TRUE&quot;.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int y;&lt;br /&gt;scanf(&quot;%d&quot;,&amp;y); // input given is 2000&lt;br /&gt;if( (y%4==0 &amp;&amp; y%100 != 0) || y%100 == 0 )&lt;br /&gt;printf(&quot;%d is a leap year&quot;);&lt;br /&gt;else&lt;br /&gt;printf(&quot;%d is not a leap year&quot;);&lt;br /&gt;}&lt;br /&gt;19&lt;br /&gt;Answer:&lt;br /&gt;2000 is a leap year&lt;br /&gt;Explanation:&lt;br /&gt;An ordinary program to check if leap year or not.&lt;br /&gt;#define max 5&lt;br /&gt;#define int arr1[max]&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;typedef char arr2[max];&lt;br /&gt;arr1 list={0,1,2,3,4};&lt;br /&gt;arr2 name=&quot;name&quot;;&lt;br /&gt;printf(&quot;%d %s&quot;,list[0],name);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error (in the line arr1 list = {0,1,2,3,4})&lt;br /&gt;Explanation:&lt;br /&gt;arr2 is declared of type array of size 5 of characters. So it can be used to declare the variable&lt;br /&gt;name of the type arr2. But it is not the case of arr1. Hence an error.&lt;br /&gt;Rule of Thumb:&lt;br /&gt;#defines are used for textual replacement whereas typedefs are used for declaring new types.&lt;br /&gt;int i=10;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;extern int i;&lt;br /&gt;{&lt;br /&gt;int i=20;&lt;br /&gt;{&lt;br /&gt;const volatile unsigned i=30;&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;}&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;}&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;30,20,10&lt;br /&gt;Explanation:&lt;br /&gt;&#39;{&#39; introduces new block and thus new scope. In the innermost block i is declared as,&lt;br /&gt;const volatile unsigned&lt;br /&gt;which is a valid declaration. i is assumed of type int. So printf prints 30. In the next block, i&lt;br /&gt;has value 20 and so printf prints 20. In the outermost block, i is declared as extern, so no&lt;br /&gt;storage space is allocated for it. After compilation is over the linker resolves it to global&lt;br /&gt;variable i (since it is the only variable visible there). So it prints i&#39;s value as 10.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int *j;&lt;br /&gt;{&lt;br /&gt;int i=10;&lt;br /&gt;j=&amp;i;&lt;br /&gt;20 }&lt;br /&gt;printf(&quot;%d&quot;,*j);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;10&lt;br /&gt;Explanation:&lt;br /&gt;The variable i is a block level variable and the visibility is inside that block only. But the&lt;br /&gt;lifetime of i is lifetime of the function so it lives upto the exit of main function. Since the i is&lt;br /&gt;still allocated space, *j prints the value stored in i since j points i.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=-1;&lt;br /&gt;-i;&lt;br /&gt;printf(&quot;i = %d, -i = %d \n&quot;,i,-i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;i = -1, -i = 1&lt;br /&gt;Explanation:&lt;br /&gt;-i is executed and this execution doesn&#39;t affect the value of i. In printf first you just print the&lt;br /&gt;value of i. After that the value of the expression -i = -(-1) is printed.&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;const int i=4;&lt;br /&gt;float j;&lt;br /&gt;j = ++i;&lt;br /&gt;printf(&quot;%d %f&quot;, i,++j);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error&lt;br /&gt;Explanation:&lt;br /&gt;i is a constant. you cannot change the value of constant&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };&lt;br /&gt;int *p,*q;&lt;br /&gt;p=&amp;a[2][2][2];&lt;br /&gt;*q=***a;&lt;br /&gt;printf(&quot;%d..%d&quot;,*p,*q);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;garbagevalue..1&lt;br /&gt;Explanation:&lt;br /&gt;p=&amp;a[2][2][2] you declare only two 2D arrays. but you are trying to access the third&lt;br /&gt;2D(which you are not declared) it will print garbage values. *q=***a starting address of a is&lt;br /&gt;assigned integer pointer. now q is pointing to starting address of a.if you print *q meAnswer:it&lt;br /&gt;will print first element of 3D array.&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;21&lt;br /&gt;{&lt;br /&gt;register i=5;&lt;br /&gt;char j[]= &quot;hello&quot;;&lt;br /&gt;printf(&quot;%s %d&quot;,j,i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;hello 5&lt;br /&gt;Explanation:&lt;br /&gt;if you declare i as register compiler will treat it as ordinary integer and it will take integer&lt;br /&gt;value. i value may be stored either in register or in memory.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=5,j=6,z;&lt;br /&gt;printf(&quot;%d&quot;,i+++j);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;11&lt;br /&gt;Explanation:&lt;br /&gt;the expression i+++j is treated as (i++ + j)&lt;br /&gt;struct aaa{&lt;br /&gt;struct aaa *prev;&lt;br /&gt;int i;&lt;br /&gt;struct aaa *next;&lt;br /&gt;};&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;struct aaa abc,def,ghi,jkl;&lt;br /&gt;int x=100;&lt;br /&gt;abc.i=0;abc.prev=&amp;jkl;&lt;br /&gt;abc.next=&amp;def;&lt;br /&gt;def.i=1;def.prev=&amp;abc;def.next=&amp;ghi;&lt;br /&gt;ghi.i=2;ghi.prev=&amp;def;&lt;br /&gt;ghi.next=&amp;jkl;&lt;br /&gt;jkl.i=3;jkl.prev=&amp;ghi;jkl.next=&amp;abc;&lt;br /&gt;x=abc.next-&gt;next-&gt;prev-&gt;next-&gt;i;&lt;br /&gt;printf(&quot;%d&quot;,x);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;2&lt;br /&gt;Explanation:&lt;br /&gt;above all statements form a double circular linked list;&lt;br /&gt;abc.next-&gt;next-&gt;prev-&gt;next-&gt;i&lt;br /&gt;this one points to &quot;ghi&quot; node the value of at particular node is 2.&lt;br /&gt;struct point&lt;br /&gt;{&lt;br /&gt;int x;&lt;br /&gt;int y;&lt;br /&gt;};&lt;br /&gt;struct point origin,*pp;&lt;br /&gt;main()&lt;br /&gt;22&lt;br /&gt;{&lt;br /&gt;pp=&amp;origin;&lt;br /&gt;printf(&quot;origin is(%d%d)\n&quot;,(*pp).x,(*pp).y);&lt;br /&gt;printf(&quot;origin is (%d%d)\n&quot;,pp-&gt;x,pp-&gt;y);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;origin is(0,0)&lt;br /&gt;origin is(0,0)&lt;br /&gt;Explanation:&lt;br /&gt;pp is a pointer to structure. we can access the elements of the structure either with arrow mark&lt;br /&gt;or with indirection operator.&lt;br /&gt;Note:&lt;br /&gt;Since structure point is globally declared x &amp; y are initialized as zeroes&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=_l_abc(10);&lt;br /&gt;printf(&quot;%d\n&quot;,--i);&lt;br /&gt;}&lt;br /&gt;int _l_abc(int i)&lt;br /&gt;{&lt;br /&gt;return(i++);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;9&lt;br /&gt;Explanation:&lt;br /&gt;return(i++) it will first return i and then increments. i.e. 10 will be returned.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char *p;&lt;br /&gt;int *q;&lt;br /&gt;long *r;&lt;br /&gt;p=q=r=0;&lt;br /&gt;p++;&lt;br /&gt;q++;&lt;br /&gt;r++;&lt;br /&gt;printf(&quot;%p...%p...%p&quot;,p,q,r);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;0001...0002...0004&lt;br /&gt;Explanation:&lt;br /&gt;++ operator when applied to pointers increments address according to their corresponding&lt;br /&gt;data-types.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char c=&#39; &#39;,x,convert(z);&lt;br /&gt;getc(c);&lt;br /&gt;if((c&gt;=&#39;a&#39;) &amp;&amp; (c&lt;=&#39;z&#39;))&lt;br /&gt;x=convert(c);&lt;br /&gt;23printf(&quot;%c&quot;,x);&lt;br /&gt;}&lt;br /&gt;convert(z)&lt;br /&gt;{&lt;br /&gt;return z-32;&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error&lt;br /&gt;Explanation:&lt;br /&gt;declaration of convert and format of getc() are wrong.&lt;br /&gt;main(int argc, char **argv)&lt;br /&gt;{&lt;br /&gt;printf(&quot;enter the character&quot;);&lt;br /&gt;getchar();&lt;br /&gt;sum(argv[1],argv[2]);&lt;br /&gt;}&lt;br /&gt;sum(num1,num2)&lt;br /&gt;int num1,num2;&lt;br /&gt;{&lt;br /&gt;return num1+num2;&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error.&lt;br /&gt;Explanation:&lt;br /&gt;argv[1] &amp; argv[2] are strings. They are passed to the function sum without converting it to&lt;br /&gt;integer values.&lt;br /&gt;# include &lt;stdio.h&gt;&lt;br /&gt;int one_d[]={1,2,3};&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int *ptr;&lt;br /&gt;ptr=one_d;&lt;br /&gt;ptr+=3;&lt;br /&gt;printf(&quot;%d&quot;,*ptr);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;garbage value&lt;br /&gt;Explanation:&lt;br /&gt;ptr pointer is pointing to out of the array range of one_d.&lt;br /&gt;# include&lt;stdio.h&gt;&lt;br /&gt;aaa() {&lt;br /&gt;printf(&quot;hi&quot;);&lt;br /&gt;}&lt;br /&gt;bbb(){&lt;br /&gt;printf(&quot;hello&quot;);&lt;br /&gt;}&lt;br /&gt;ccc(){&lt;br /&gt;printf(&quot;bye&quot;);&lt;br /&gt;}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;24&lt;br /&gt;int (*ptr[3])();&lt;br /&gt;ptr[0]=aaa;&lt;br /&gt;ptr[1]=bbb;&lt;br /&gt;ptr[2]=ccc;&lt;br /&gt;ptr[2]();&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;bye&lt;br /&gt;Explanation:&lt;br /&gt;ptr is array of pointers to functions of return type int.ptr[0] is assigned to address of the&lt;br /&gt;function aaa. Similarly ptr[1] and ptr[2] for bbb and ccc respectively. ptr[2]() is in effect of&lt;br /&gt;writing ccc(), since ptr[2] points to ccc.&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;FILE *ptr;&lt;br /&gt;char i;&lt;br /&gt;ptr=fopen(&quot;zzz.c&quot;,&quot;r&quot;);&lt;br /&gt;while((i=fgetch(ptr))!=EOF)&lt;br /&gt;printf(&quot;%c&quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;contents of zzz.c followed by an infinite loop&lt;br /&gt;Explanation:&lt;br /&gt;The condition is checked against EOF, it should be checked against NULL.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i =0;j=0;&lt;br /&gt;if(i &amp;&amp; j++)&lt;br /&gt;printf(&quot;%d..%d&quot;,i++,j);&lt;br /&gt;printf(&quot;%d..%d,i,j);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;0..0&lt;br /&gt;Explanation:&lt;br /&gt;The value of i is 0. Since this information is enough to determine the truth value of the boolean&lt;br /&gt;expression. So the statement following the if statement is not executed. The values of i and j&lt;br /&gt;remain unchanged and get printed.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i;&lt;br /&gt;i = abc();&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;}&lt;br /&gt;abc()&lt;br /&gt;{&lt;br /&gt;_AX = 1000;&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;1000&lt;br /&gt;25&lt;br /&gt;Explanation:&lt;br /&gt;Normally the return value from the function is through the information from the accumulator.&lt;br /&gt;Here _AH is the pseudo global variable denoting the accumulator. Hence, the value of the&lt;br /&gt;accumulator is set 1000 so the function returns value 1000.&lt;br /&gt;int i;&lt;br /&gt;main(){&lt;br /&gt;int t;&lt;br /&gt;for ( t=4;scanf(&quot;%d&quot;,&amp;i)-t;printf(&quot;%d\n&quot;,i))&lt;br /&gt;printf(&quot;%d--&quot;,t--);&lt;br /&gt;}&lt;br /&gt;// If the inputs are 0,1,2,3 find the o/p&lt;br /&gt;Answer:&lt;br /&gt;4--0&lt;br /&gt;3--1&lt;br /&gt;2--2&lt;br /&gt;Explanation:&lt;br /&gt;Let us assume some x= scanf(&quot;%d&quot;,&amp;i)-t the values during execution&lt;br /&gt;will be,&lt;br /&gt;t&lt;br /&gt;i&lt;br /&gt;x&lt;br /&gt;4&lt;br /&gt;0&lt;br /&gt;-4&lt;br /&gt;3&lt;br /&gt;1&lt;br /&gt;-2&lt;br /&gt;2&lt;br /&gt;2&lt;br /&gt;0&lt;br /&gt;main(){&lt;br /&gt;int a= 0;int b = 20;char x =1;char y =10;&lt;br /&gt;if(a,b,x,y)&lt;br /&gt;printf(&quot;hello&quot;);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;hello&lt;br /&gt;Explanation:&lt;br /&gt;The comma operator has associativity from left to right. Only the rightmost value is returned&lt;br /&gt;and the other values are evaluated and ignored. Thus the value of last variable y is returned to&lt;br /&gt;check in if. Since it is a non zero value if becomes true so, &quot;hello&quot; will be printed.&lt;br /&gt;main(){&lt;br /&gt;unsigned int i;&lt;br /&gt;for(i=1;i&gt;-2;i--)&lt;br /&gt;printf(&quot;c aptitude&quot;);&lt;br /&gt;}&lt;br /&gt;Explanation:&lt;br /&gt;i is an unsigned integer. It is compared with a signed value. Since the both types doesn&#39;t match,&lt;br /&gt;signed is promoted to unsigned value. The unsigned equivalent of -2 is a huge value so&lt;br /&gt;condition becomes false and control comes out of the loop.&lt;br /&gt;In the following pgm add a stmt in the function fun such that the address of&lt;br /&gt;&#39;a&#39; gets stored in &#39;j&#39;.&lt;br /&gt;main(){&lt;br /&gt;int * j;&lt;br /&gt;void fun(int **);&lt;br /&gt;fun(&amp;j);&lt;br /&gt;}&lt;br /&gt;26&lt;br /&gt;void fun(int **k) {&lt;br /&gt;int a =0;&lt;br /&gt;/* add a stmt here*/&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;*k = &amp;a&lt;br /&gt;Explanation:&lt;br /&gt;The argument of the function is a pointer to a pointer.&lt;br /&gt;What are the following notations of defining functions known as?&lt;br /&gt;i.&lt;br /&gt;int abc(int a,float b)&lt;br /&gt;{&lt;br /&gt;/* some code */&lt;br /&gt;}&lt;br /&gt;ii. int abc(a,b)&lt;br /&gt;int a; float b;&lt;br /&gt;{&lt;br /&gt;/* some code*/&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;i. ANSI C notation&lt;br /&gt;ii. Kernighan &amp; Ritche notation&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char *p;&lt;br /&gt;p=&quot;%d\n&quot;;&lt;br /&gt;p++;&lt;br /&gt;p++;&lt;br /&gt;printf(p-2,300);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;300&lt;br /&gt;Explanation:&lt;br /&gt;The pointer points to % since it is incremented twice and again decremented by 2, it points to&lt;br /&gt;&#39;%d\n&#39; and 300 is printed.&lt;br /&gt;main(){&lt;br /&gt;char a[100];&lt;br /&gt;a[0]=&#39;a&#39;;a[1]]=&#39;b&#39;;a[2]=&#39;c&#39;;a[4]=&#39;d&#39;;&lt;br /&gt;abc(a);&lt;br /&gt;}&lt;br /&gt;abc(char a[]){&lt;br /&gt;a++;&lt;br /&gt;printf(&quot;%c&quot;,*a);&lt;br /&gt;a++;&lt;br /&gt;printf(&quot;%c&quot;,*a);&lt;br /&gt;}&lt;br /&gt;Explanation:&lt;br /&gt;The base address is modified only in function and as a result a points to &#39;b&#39; then after&lt;br /&gt;incrementing to &#39;c&#39; so bc will be printed.&lt;br /&gt;func(a,b)&lt;br /&gt;27&lt;br /&gt;int a,b;&lt;br /&gt;{&lt;br /&gt;return( a= (a==b) );&lt;br /&gt;}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int process(),func();&lt;br /&gt;printf(&quot;The value of process is %d !\n &quot;,process(func,3,6));&lt;br /&gt;}&lt;br /&gt;process(pf,val1,val2)&lt;br /&gt;int (*pf) ();&lt;br /&gt;int val1,val2;&lt;br /&gt;{&lt;br /&gt;return((*pf) (val1,val2));&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;The value if process is 0 !&lt;br /&gt;Explanation:&lt;br /&gt;The function &#39;process&#39; has 3 parameters - 1, a pointer to another function 2 and 3, integers.&lt;br /&gt;When this function is invoked from main, the following substitutions for formal parameters&lt;br /&gt;take place: func for pf, 3 for val1 and 6 for val2. This function returns the result of the&lt;br /&gt;operation performed by the function &#39;func&#39;. The function func has two integer parameters. The&lt;br /&gt;formal parameters are substituted as 3 for a and 6 for b. since 3 is not equal to 6, a==b returns&lt;br /&gt;0. therefore the function returns 0 which in turn is returned by the function &#39;process&#39;.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;static int i=5;&lt;br /&gt;if(--i){&lt;br /&gt;main();&lt;br /&gt;printf(&quot;%d &quot;,i);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;0000&lt;br /&gt;Explanation:&lt;br /&gt;The variable &quot;I&quot; is declared as static, hence memory for I will be allocated for only once, as it&lt;br /&gt;encounters the statement. The function main() will be called recursively unless I becomes equal to 0,&lt;br /&gt;and since main() is recursively called, so the value of static I ie., 0 will be printed every time the&lt;br /&gt;control is returned.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int k=ret(sizeof(float));&lt;br /&gt;printf(&quot;\n here value is %d&quot;,++k);&lt;br /&gt;}&lt;br /&gt;int ret(int ret)&lt;br /&gt;{&lt;br /&gt;ret += 2.5;&lt;br /&gt;return(ret);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Here value is 7&lt;br /&gt;28&lt;br /&gt;Explanation:&lt;br /&gt;The int ret(int ret), ie., the function name and the argument name can be the same.&lt;br /&gt;Firstly, the function ret() is called in which the sizeof(float) ie., 4 is passed, after the first&lt;br /&gt;expression the value in ret will be 6, as ret is integer hence the value stored in ret will have implicit&lt;br /&gt;type conversion from float to int. The ret is returned in main() it is printed after and preincrement.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;char a[]=&quot;12345\0&quot;;&lt;br /&gt;int i=strlen(a);&lt;br /&gt;printf(&quot;here in 3 %d\n&quot;,++i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;here in 3 6&lt;br /&gt;Explanation:&lt;br /&gt;The char array &#39;a&#39; will hold the initialized string, whose length will be counted from 0 till the&lt;br /&gt;null character. Hence the &#39;I&#39; will hold the value equal to 5, after the pre-increment in the printf&lt;br /&gt;statement, the 6 will be printed.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;unsigned giveit=-1;&lt;br /&gt;int gotit;&lt;br /&gt;printf(&quot;%u &quot;,++giveit);&lt;br /&gt;printf(&quot;%u \n&quot;,gotit=--giveit);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;0 65535&lt;br /&gt;Explanation:&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int i;&lt;br /&gt;char a[]=&quot;\0&quot;;&lt;br /&gt;if(printf(&quot;%s\n&quot;,a))&lt;br /&gt;printf(&quot;Ok here \n&quot;);&lt;br /&gt;else&lt;br /&gt;printf(&quot;Forget it\n&quot;);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Ok here&lt;br /&gt;Explanation:&lt;br /&gt;Printf will return how many characters does it print. Hence printing a null character&lt;br /&gt;returns 1 which makes the if statement true, thus &quot;Ok here&quot; is printed.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;void *v;&lt;br /&gt;int integer=2;&lt;br /&gt;int *i=&amp;integer;&lt;br /&gt;v=i;&lt;br /&gt;printf(&quot;%d&quot;,(int*)*v);&lt;br /&gt;}&lt;br /&gt;29&lt;br /&gt;Answer:&lt;br /&gt;Compiler Error. We cannot apply indirection on type void*.&lt;br /&gt;Explanation:&lt;br /&gt;Void pointer is a generic pointer type. No pointer arithmetic can be done on it. Void&lt;br /&gt;pointers are normally used for,&lt;br /&gt;1. Passing generic pointers to functions and returning such pointers.&lt;br /&gt;2. As a intermediate pointer type.&lt;br /&gt;3. Used when the exact pointer type will be known at a later point of time.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int i=i++,j=j++,k=k++;&lt;br /&gt;printf(“%d%d%d”,i,j,k);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Garbage values.&lt;br /&gt;Explanation:&lt;br /&gt;An identifier is available to use in program code from the point of its declaration.&lt;br /&gt;So expressions such as i = i++ are valid statements. The i, j and k are automatic variables and&lt;br /&gt;so they contain some garbage value. Garbage in is garbage out (GIGO).&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;static int i=i++, j=j++, k=k++;&lt;br /&gt;printf(“i = %d j = %d k = %d”, i, j, k);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;i=1j=1k=1&lt;br /&gt;Explanation:&lt;br /&gt;Since static variables are initialized to zero by default.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;while(1){&lt;br /&gt;if(printf(&quot;%d&quot;,printf(&quot;%d&quot;)))&lt;br /&gt;break;&lt;br /&gt;else&lt;br /&gt;continue;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Garbage values&lt;br /&gt;Explanation:&lt;br /&gt;The inner printf executes first to print some garbage value. The printf returns no of characters&lt;br /&gt;printed and this value also cannot be predicted. Still the outer printf prints something and so&lt;br /&gt;returns a non-zero value. So it encounters the break statement and comes out of the while&lt;br /&gt;statement.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;unsigned int i=10;&lt;br /&gt;while(i--&gt;=0)&lt;br /&gt;30&lt;br /&gt;printf(&quot;%u &quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;10 9 8 7 6 5 4 3 2 1 0 65535 65534…..&lt;br /&gt;Explanation:&lt;br /&gt;Since i is an unsigned integer it can never become negative. So the expression i-- &gt;=0 will&lt;br /&gt;always be true, leading to an infinite loop.&lt;br /&gt;#include&lt;conio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int x,y=2,z,a;&lt;br /&gt;if(x=y%2) z=2;&lt;br /&gt;a=2;&lt;br /&gt;printf(&quot;%d %d &quot;,z,x);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Garbage-value 0&lt;br /&gt;Explanation:&lt;br /&gt;The value of y%2 is 0. This value is assigned to x. The condition reduces to if (x) or in other&lt;br /&gt;words if(0) and so z goes uninitialized.&lt;br /&gt;Thumb Rule: Check all control paths to write bug free code.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int a[10];&lt;br /&gt;printf(&quot;%d&quot;,*a+1-*a+3);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;4&lt;br /&gt;Explanation:&lt;br /&gt;*a and -*a cancels out. The result is as simple as 1 + 3 = 4 !&lt;br /&gt;#define prod(a,b) a*b&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int x=3,y=4;&lt;br /&gt;printf(&quot;%d&quot;,prod(x+2,y-1));&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;10&lt;br /&gt;Explanation:&lt;br /&gt;The macro expands and evaluates to as:&lt;br /&gt;x+2*y-1 =&gt; x+(2*y)-1 =&gt; 10&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;unsigned int i=65000;&lt;br /&gt;while(i++!=0);&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;31&lt;br /&gt;1&lt;br /&gt;Explanation:&lt;br /&gt;Note the semicolon after the while statement. When the value of i becomes 0 it comes out of&lt;br /&gt;while loop. Due to post-increment on i the value of i while printing is 1.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=0;&lt;br /&gt;while(+(+i--)!=0)&lt;br /&gt;i-=i++;&lt;br /&gt;printf(&quot;%d&quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;-1&lt;br /&gt;Explanation:&lt;br /&gt;Unary + is the only dummy operator in C. So it has no effect on the expression and now the&lt;br /&gt;while loop is, while(i--!=0) which is false and so breaks out of while loop. The value –1 is&lt;br /&gt;printed due to the post-decrement operator.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;float f=5,g=10;&lt;br /&gt;enum{i=10,j=20,k=50};&lt;br /&gt;printf(&quot;%d\n&quot;,++k);&lt;br /&gt;printf(&quot;%f\n&quot;,f&lt;&lt;2);&lt;br /&gt;printf(&quot;%lf\n&quot;,f%g);&lt;br /&gt;printf(&quot;%lf\n&quot;,fmod(f,g));&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Line no 5: Error: Lvalue required&lt;br /&gt;Line no 6: Cannot apply leftshift to float&lt;br /&gt;Line no 7: Cannot apply mod to float&lt;br /&gt;Explanation:&lt;br /&gt;Enumeration constants cannot be modified, so you cannot apply ++.&lt;br /&gt;Bit-wise operators and % operators cannot be applied on float values.&lt;br /&gt;fmod() is to find the modulus values for floats as % operator is for ints.&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=10;&lt;br /&gt;void pascal f(int,int,int);&lt;br /&gt;f(i++,i++,i++);&lt;br /&gt;printf(&quot; %d&quot;,i);&lt;br /&gt;}&lt;br /&gt;void pascal f(integer :i,integer:j,integer :k)&lt;br /&gt;{&lt;br /&gt;write(i,j,k);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error: unknown type integer&lt;br /&gt;Compiler error: undeclared function write&lt;br /&gt;Explanation:&lt;br /&gt;32&lt;br /&gt;Pascal keyword doesn’t mean that pascal code can be used. It means that the function follows&lt;br /&gt;Pascal argument passing mechanism in calling the functions.&lt;br /&gt;void pascal f(int i,int j,int k)&lt;br /&gt;{&lt;br /&gt;printf(“%d %d %d”,i, j, k);&lt;br /&gt;}&lt;br /&gt;void cdecl f(int i,int j,int k)&lt;br /&gt;{&lt;br /&gt;printf(“%d %d %d”,i, j, k);&lt;br /&gt;}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=10;&lt;br /&gt;f(i++,i++,i++);&lt;br /&gt;printf(&quot; %d\n&quot;,i);&lt;br /&gt;i=10;&lt;br /&gt;f(i++,i++,i++);&lt;br /&gt;printf(&quot; %d&quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;10 11 12 13&lt;br /&gt;12 11 10 13&lt;br /&gt;Explanation:&lt;br /&gt;Pascal argument passing mechanism forces the arguments to be called from left to right. cdecl&lt;br /&gt;is the normal C argument passing mechanism where the arguments are passed from right to left.&lt;br /&gt;112). What is the output of the program given below&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;signed char i=0;&lt;br /&gt;for(;i&gt;=0;i++) ;&lt;br /&gt;printf(&quot;%d\n&quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer&lt;br /&gt;-128&lt;br /&gt;Explanation&lt;br /&gt;Notice the semicolon at the end of the for loop. THe initial value of the i is set to 0.&lt;br /&gt;The inner loop executes to increment the value from 0 to 127 (the positive range of&lt;br /&gt;char) and then it rotates to the negative value of -128. The condition in the for loop&lt;br /&gt;fails and so comes out of the for loop. It prints the current value of i that is -128.&lt;br /&gt;113) main()&lt;br /&gt;{&lt;br /&gt;unsigned char i=0;&lt;br /&gt;for(;i&gt;=0;i++) ;&lt;br /&gt;printf(&quot;%d\n&quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer&lt;br /&gt;infinite loop&lt;br /&gt;Explanation&lt;br /&gt;33&lt;br /&gt;The difference between the previous question and this one is that the char is declared to be&lt;br /&gt;unsigned. So the i++ can never yield negative value and i&gt;=0 never becomes false so that it can come&lt;br /&gt;out of the for loop.&lt;br /&gt;114) main()&lt;br /&gt;{&lt;br /&gt;char i=0;&lt;br /&gt;for(;i&gt;=0;i++) ;&lt;br /&gt;printf(&quot;%d\n&quot;,i);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Behavior is implementation dependent.&lt;br /&gt;Explanation:&lt;br /&gt;The detail if the char is signed/unsigned by default is implementation dependent. If the&lt;br /&gt;implementation treats the char to be signed by default the program will print –128 and&lt;br /&gt;terminate. On the other hand if it considers char to be unsigned by default, it goes to infinite&lt;br /&gt;loop.&lt;br /&gt;Rule:&lt;br /&gt;You can write programs that have implementation dependent behavior. But dont write&lt;br /&gt;programs that depend on such behavior.&lt;br /&gt;115) Is the following statement a declaration/definition. Find what does it mean?&lt;br /&gt;int (*x)[10];&lt;br /&gt;Answer&lt;br /&gt;Definition.&lt;br /&gt;x is a pointer to array of(size 10) integers.&lt;br /&gt;Apply clock-wise rule to find the meaning of this definition.&lt;br /&gt;116). What is the output for the program given below&lt;br /&gt;typedef enum errorType{warning, error, exception,}error;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;error g1;&lt;br /&gt;g1=1;&lt;br /&gt;printf(&quot;%d&quot;,g1);&lt;br /&gt;}&lt;br /&gt;Answer&lt;br /&gt;Compiler error: Multiple declaration for error&lt;br /&gt;Explanation&lt;br /&gt;The name error is used in the two meanings. One means that it is a enumerator&lt;br /&gt;constant with value 1. The another use is that it is a type name (due to typedef) for enum&lt;br /&gt;errorType. Given a situation the compiler cannot distinguish the meaning of error to know in&lt;br /&gt;what sense the error is used:&lt;br /&gt;error g1;&lt;br /&gt;g1=error;&lt;br /&gt;// which error it refers in each case?&lt;br /&gt;When the compiler can distinguish between usages then it will not issue error (in pure&lt;br /&gt;technical terms, names can only be overloaded in different namespaces).&lt;br /&gt;Note: the extra comma in the declaration,&lt;br /&gt;34&lt;br /&gt;enum errorType{warning, error, exception,}&lt;br /&gt;is not an error. An extra comma is valid and is provided just for programmer’s convenience.&lt;br /&gt;117)&lt;br /&gt;typedef struct error{int warning, error, exception;}error;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;error g1;&lt;br /&gt;g1.error =1;&lt;br /&gt;printf(&quot;%d&quot;,g1.error);&lt;br /&gt;}&lt;br /&gt;Answer&lt;br /&gt;1&lt;br /&gt;Explanation&lt;br /&gt;The three usages of name errors can be distinguishable by the compiler at any instance, so&lt;br /&gt;valid (they are in different namespaces).&lt;br /&gt;Typedef struct error{int warning, error, exception;}error;&lt;br /&gt;This error can be used only by preceding the error by struct kayword as in:&lt;br /&gt;struct error someError;&lt;br /&gt;typedef struct error{int warning, error, exception;}error;&lt;br /&gt;This can be used only after . (dot) or -&gt; (arrow) operator preceded by the variable name as in :&lt;br /&gt;g1.error =1;&lt;br /&gt;printf(&quot;%d&quot;,g1.error);&lt;br /&gt;typedef struct error{int warning, error, exception;}error;&lt;br /&gt;This can be used to define variables without using the preceding struct keyword as in:&lt;br /&gt;error g1;&lt;br /&gt;Since the compiler can perfectly distinguish between these three usages, it is perfectly legal and valid.&lt;br /&gt;Note&lt;br /&gt;This code is given here to just explain the concept behind. In real programming don’t use such&lt;br /&gt;overloading of names. It reduces the readability of the code. Possible doesn’t mean that we should use&lt;br /&gt;it!&lt;br /&gt;118)&lt;br /&gt;#ifdef something&lt;br /&gt;int some=0;&lt;br /&gt;#endif&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int thing = 0;&lt;br /&gt;printf(&quot;%d %d\n&quot;, some ,thing);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error : undefined symbol some&lt;br /&gt;Explanation:&lt;br /&gt;This is a very simple example for conditional compilation. The name something is not&lt;br /&gt;already known to the compiler making the declaration&lt;br /&gt;int some = 0;&lt;br /&gt;effectively removed from the source code.&lt;br /&gt;119)&lt;br /&gt;#if something == 0&lt;br /&gt;35&lt;br /&gt;int some=0;&lt;br /&gt;#endif&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int thing = 0;&lt;br /&gt;printf(&quot;%d %d\n&quot;, some ,thing);&lt;br /&gt;}&lt;br /&gt;Answer&lt;br /&gt;00&lt;br /&gt;Explanation&lt;br /&gt;This code is to show that preprocessor expressions are not the same as the ordinary&lt;br /&gt;expressions. If a name is not known the preprocessor treats it to be equal to zero.&lt;br /&gt;120). What is the output for the following program&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int arr2D[3][3];&lt;br /&gt;printf(&quot;%d\n&quot;, ((arr2D==* arr2D)&amp;&amp;(* arr2D == arr2D[0])) );&lt;br /&gt;}&lt;br /&gt;Answer&lt;br /&gt;1&lt;br /&gt;Explanation&lt;br /&gt;This is due to the close relation between the arrays and pointers. N dimensional arrays&lt;br /&gt;are made up of (N-1) dimensional arrays.&lt;br /&gt;arr2D is made up of a 3 single arrays that contains 3 integers each .&lt;br /&gt;arr2D&lt;br /&gt;arr2D[1]&lt;br /&gt;arr2D[2]&lt;br /&gt;arr2D[3]&lt;br /&gt;The name arr2D refers to the beginning of all the 3 arrays. *arr2D refers to the start of&lt;br /&gt;the first 1D array (of 3 integers) that is the same address as arr2D. So the expression&lt;br /&gt;(arr2D == *arr2D) is true (1).&lt;br /&gt;Similarly, *arr2D is nothing but *(arr2D + 0), adding a zero doesn’t change the&lt;br /&gt;value/meaning. Again arr2D[0] is the another way of telling *(arr2D + 0). So the&lt;br /&gt;expression (*(arr2D + 0) == arr2D[0]) is true (1).&lt;br /&gt;Since both parts of the expression evaluates to true the result is true(1) and the same is&lt;br /&gt;printed.&lt;br /&gt;121) void main()&lt;br /&gt;{&lt;br /&gt;if(~0 == (unsigned int)-1)&lt;br /&gt;printf(“You can answer this if you know how values are represented in memory”);&lt;br /&gt;}&lt;br /&gt;Answer&lt;br /&gt;You can answer this if you know how values are represented in memory&lt;br /&gt;Explanation&lt;br /&gt;36&lt;br /&gt;~ (tilde operator or bit-wise negation operator) operates on 0 to produce all ones to fill&lt;br /&gt;the space for an integer. –1 is represented in unsigned value as all 1’s and so both are&lt;br /&gt;equal.&lt;br /&gt;122) int swap(int *a,int *b)&lt;br /&gt;{&lt;br /&gt;*a=*a+*b;*b=*a-*b;*a=*a-*b;&lt;br /&gt;}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int x=10,y=20;&lt;br /&gt;swap(&amp;x,&amp;y);&lt;br /&gt;printf(&quot;x= %d y = %d\n&quot;,x,y);&lt;br /&gt;}&lt;br /&gt;Answer&lt;br /&gt;x = 20 y = 10&lt;br /&gt;Explanation&lt;br /&gt;This is one way of swapping two values. Simple checking will help understand this.&lt;br /&gt;123)&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char *p = “ayqm”;&lt;br /&gt;printf(“%c”,++*(p++));&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;b&lt;br /&gt;124)&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=5;&lt;br /&gt;printf(&quot;%d&quot;,++i++);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;Compiler error: Lvalue required in function main&lt;br /&gt;Explanation:&lt;br /&gt;++i yields an rvalue. For postfix ++ to operate an lvalue is required.&lt;br /&gt;125)&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;char *p = “ayqm”;&lt;br /&gt;char c;&lt;br /&gt;c = ++*p++;&lt;br /&gt;printf(“%c”,c);&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;b&lt;br /&gt;Explanation:&lt;br /&gt;There is no difference between the expression ++*(p++) and ++*p++. Parenthesis just&lt;br /&gt;works as a visual clue for the reader to see which expression is first evaluated.&lt;br /&gt;126)&lt;br /&gt;int aaa() {printf(“Hi”);}&lt;br /&gt;int bbb(){printf(“hello”);}&lt;br /&gt;37&lt;br /&gt;iny ccc(){printf(“bye”);}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int ( * ptr[3]) ();&lt;br /&gt;ptr[0] = aaa;&lt;br /&gt;ptr[1] = bbb;&lt;br /&gt;ptr[2] =ccc;&lt;br /&gt;ptr[2]();&lt;br /&gt;}&lt;br /&gt;Answer:&lt;br /&gt;bye&lt;br /&gt;Explanation:&lt;br /&gt;int (* ptr[3])() says that ptr is an array of pointers to functions that takes no arguments and&lt;br /&gt;returns the type int. By the assignment ptr[0] = aaa; it means that the first function pointer in&lt;br /&gt;the array is initialized with the address of the function aaa. Similarly, the other two array&lt;br /&gt;elements also get initialized with the addresses of the functions bbb and ccc. Since ptr[2]&lt;br /&gt;contains the address of the function ccc, the call to the function ptr[2]() is same as calling&lt;br /&gt;ccc(). So it results in printing &quot;bye&quot;.&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/8232762203802715322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/8232762203802715322' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/8232762203802715322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/8232762203802715322'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2010/03/good-collection-of-c-n-c-interview.html' title='Good collection of C n C++ interview written Questions and answers'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-3529587500780410949</id><published>2010-03-11T11:35:00.000+05:30</published><updated>2010-03-11T11:38:57.867+05:30</updated><title type='text'>C++ Class Member Initialization order....</title><content type='html'>Sample Code....&lt;br /&gt;class Test&lt;br /&gt;{&lt;br /&gt; int x;&lt;br /&gt; int y;&lt;br /&gt;public:Test(int z)&lt;br /&gt; {&lt;br /&gt;  x=y=z;&lt;br /&gt; }&lt;br /&gt;};&lt;br /&gt;class Test1&lt;br /&gt;{&lt;br /&gt;  Test t;&lt;br /&gt;  const int b;&lt;br /&gt;  Test1(int z):t(1),b(10)&lt;br /&gt; {&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CSomeClass::CSomeClass()&lt;br /&gt;{&lt;br /&gt;    x=0;&lt;br /&gt;    y=1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;and in other places I see it written this way:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CSomeClass::CSomeClass() : x(0), y(1)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Some of my programmer friends say that it&#39;s better to do it the second way, but no one knows why. Can you tell me the difference between these two methods of initializing class members?&lt;br /&gt;A&lt;br /&gt;Technically your friends are right, but in most cases it makes no difference. There are two reasons to use the second syntax, which is called a member initialization list: one is necessity, the other efficiency.&lt;br /&gt;      Let&#39;s examine the first reasonâ&quot;necessity. Suppose you have a class member that is itself a class or struct, and this class only has one constructor that requires an argument.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class CMember {&lt;br /&gt;public:&lt;br /&gt;    CMember(int x) { ... }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;Since CMember has an explicit constructor, the compiler does not generate a default constructor (one with no arguments) and there is no way to create an instance of CMember without an integer.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CMember* pm = new CMember;        // Error!!&lt;br /&gt;CMember* pm = new CMember(2);     // OK&lt;br /&gt;&lt;br /&gt;      How do you initialize CMember if it&#39;s a member of another class? You must use the member initialization list.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class CMyClass {&lt;br /&gt;    CMember m_member;&lt;br /&gt;public:&lt;br /&gt;    CMyClass();&lt;br /&gt;};&lt;br /&gt;// must use initializer list&lt;br /&gt;CMyClass::CMyClass() : m_member(2)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;â¢â¢â¢&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;There&#39;s simply no other way to pass the argument to m_member. The same is true if the member is a const object or reference. According to the rules of C++, const objects and references cannot be assigned; they can only be initialized.&lt;br /&gt;      The second reason for using the initializer listâ&quot;efficiencyâ&quot;arises when the member class has a default constructor as well as an assignment operator. MFC&#39;s CString offers a perfect example. Say you have a class CMyClass with a CString member m_str and you want to initialize m_str to &quot;yada yada.&quot; You have two choices&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CMyClass::CMyClass() {&lt;br /&gt;    // use assignment operator&lt;br /&gt;    // CString::operator=(LPCTSTR);&lt;br /&gt;    m_str = _T(&quot;yada yada&quot;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// use initializer list&lt;br /&gt;// and constructor CString::CString(LPCTSTR)&lt;br /&gt;CMyClass::CMyClass() : m_str(_T(&quot;yada yada&quot;))&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;      Is there any difference between these methods? Yes. The compiler always insures that all member objects are initialized before the body of the constructor executes, so in the first example the compiled code will call CString::CString to initialize m_str before control reaches the assignment statement. In the second example, the compiler generates a call to CString:: CString(LPCTSTR), passing &quot;yada yada&quot; as the string. The upshot is that in the first example two CString functions are called (constructor and assignment operator), whereas in the second example only one function is called.&lt;br /&gt;      In the case of CString it hardly matters, since the default constructor is inline and CString only allocates storage for the string when it&#39;s needed (that is, when you actually set it to something). But, in general, the duplicate function call can be wasteful, particularly if both constructor and assignment operator allocate storage. In some large classes, you may have a constructor and assignment operator that both call the same Init function, which allocates a large amount of memory. In that particular case, you must use the initializer list in order to avoid needlessly allocating the storage twice.&lt;br /&gt;      In the case of built-in types like ints or longs or other types with no constructors, there&#39;s no performance difference between initializing an int in the initializer list or assigning it in the constructor body. Either way, there will be one assignment. Some programmers say you should always use the initializer list just to get in the habit, but I have never found it difficult to switch between the two methods as needed. Stylistically, I prefer assignment in the body because there&#39;s more room for formatting and comments, and you can write things like&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;x=y=z=0;&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;memset(this,0,sizeof(this));&lt;br /&gt;&lt;br /&gt;Note that the second snippet is decidedly non-object-oriented.&lt;br /&gt;      While I&#39;m on the subject of initializer lists, there&#39;s one peculiar feature I should warn you about. C++ initializes class members in the order they are declared, not the order they appear in the initializer list.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class CMyClass {&lt;br /&gt;    CMyClass(int x, int y);&lt;br /&gt;    int m_x;&lt;br /&gt;    int m_y;&lt;br /&gt;};&lt;br /&gt;CMyClass::CMyClass(int i) : m_y(i), m_x(m_y)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;      You might think that the previous code would first assign m_y=i and then m_x=m_y so that both m_x and m_y would have the same value. But the compiler initializes m_x first then m_y, since that&#39;s the order in which they are declared. The result is that m_x will have an unpredictable value. My example is contrived to illustrate the point, but there are times when this bug arises more naturally. There are two ways to avoid it. First, always declare members in the order you want them initialized. Second, if you decide to use an initializer list, always list the members in the same order they&#39;re declared. This will help you avoid confusion.&lt;br /&gt;&lt;br /&gt;Good Artical:::&lt;br /&gt;&lt;a href=&quot;http://http://msdn.microsoft.com/en-us/magazine/cc301399.aspx&quot;&gt;MSDN artical &lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/3529587500780410949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/3529587500780410949' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3529587500780410949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3529587500780410949'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2010/03/c-class-member-initialization-order.html' title='C++ Class Member Initialization order....'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-2484731412411225454</id><published>2009-11-04T00:15:00.000+05:30</published><updated>2009-11-04T00:24:05.697+05:30</updated><title type='text'>MySql from Command prompt</title><content type='html'>To Access your MySql Database server via command prompt steps are as follows:&lt;br /&gt;1.Connect to Database server.&lt;br /&gt;2.Select Database&lt;br /&gt;3.Run MySql Queries.&lt;br /&gt;&lt;br /&gt;Commands for all these steps:&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;1.Connect to database.--&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Enter the bin directory of database like -&lt;/span&gt;&lt;br /&gt;c:\cd C:\xampp\mysql\bin&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Connect to databse server:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;C:\&gt;..\bin\mysql -u username -h localhost -p [press enter]&lt;br /&gt;will prmpt for password&lt;br /&gt;Enter password &gt; &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;now..connect to database:-&lt;/span&gt;&lt;br /&gt;mysql&gt; use [databasename]&lt;br /&gt;&lt;br /&gt;now start executing quieries&lt;br /&gt;&gt;&lt;br /&gt;&lt;br /&gt;enjoy MySql queries ....&lt;br /&gt;best of luck</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/2484731412411225454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/2484731412411225454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/2484731412411225454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/2484731412411225454'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/11/mysql-from-command-prompt.html' title='MySql from Command prompt'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-2791985870148156457</id><published>2009-10-28T17:48:00.000+05:30</published><updated>2009-10-28T18:04:23.038+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="add custom clumn"/><category scheme="http://www.blogger.com/atom/ns#" term="C++ code outlook"/><category scheme="http://www.blogger.com/atom/ns#" term="new field"/><category scheme="http://www.blogger.com/atom/ns#" term="Outllook view"/><category scheme="http://www.blogger.com/atom/ns#" term="outlook inbox view code"/><title type='text'>Customize Outlook message inbox View VC++ code</title><content type='html'>Here I am using VC++ code and OUTLOOK object model to add new column or field in outlook inbox message view.&lt;br /&gt;&lt;br /&gt;Like other fields ( importance,subject date ....) i am going to add new custom field.&lt;br /&gt;&lt;br /&gt;**Note...I tried a lot to add a ICON type value using bitmap like read unread mail in that column bt i couldnt...&lt;br /&gt;&lt;br /&gt;In simple I used a text type value for this field:&lt;br /&gt;Bellow two functions written :&lt;br /&gt;&lt;br /&gt;Over view:&lt;br /&gt;MicroSoft stores the Outlook view in XML form just need to get the XML and modify it.&lt;br /&gt;a lots of security and other issue involved here to know morw about it go to &lt;strong&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa155658(office.10).aspx&quot;&gt;Creating Custom Views&lt;/a&gt;&lt;/strong&gt; artical of microsoft and get alot:&lt;br /&gt;&lt;br /&gt;CConnect::AddNewViewField()&lt;br /&gt;{&lt;br /&gt; Outlook::_NameSpace * pNamespacePtr;&lt;br /&gt; MAPIFolder *pFolderptr;&lt;br /&gt; View * pViewPtr;&lt;br /&gt; BSTR strXMl;&lt;br /&gt; BSTR  modifiedXMLSTr;&lt;br /&gt; m_spApp-&gt;GetNamespace(_T(&quot;MAPI&quot;),&amp;pNamespacePtr);&lt;br /&gt; pNamespacePtr-&gt;GetDefaultFolder(olFolderInbox , &amp;pFolderptr);&lt;br /&gt; pFolderptr-&gt;get_CurrentView(&amp;pViewPtr);&lt;br /&gt; pViewPtr-&gt;get_XML(&amp;strXMl); &lt;br /&gt; modifiedXMLSTr = CustomizeXMLString(strXMl);&lt;br /&gt; pViewPtr-&gt;put_XML(modifiedXMLSTr);&lt;br /&gt; pViewPtr-&gt;Save();&lt;br /&gt; pViewPtr-&gt;Apply();&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//Its concern to use .net functionality to XML parsing&lt;br /&gt;&lt;br /&gt;BSTR CustomizeXMLString(BSTR pbstrXML)&lt;br /&gt;{&lt;br /&gt; System::Xml::XmlDocument ^ XMLDocobj = gcnew System::Xml::XmlDocument();&lt;br /&gt; IntPtr p(pbstrXML);&lt;br /&gt; XMLDocobj-&gt;LoadXml(System::Runtime::InteropServices::Marshal::PtrToStringAuto(p));&lt;br /&gt; Xml::XmlNode ^ rootObj;&lt;br /&gt; rootObj = XMLDocobj-&gt;DocumentElement;&lt;br /&gt; Xml::XmlElement ^ xmlElement;&lt;br /&gt; Xml::XmlElement ^ xmlElement1;&lt;br /&gt;// rootObj-&gt;InsertAfter(,rootObj-&gt;SelectSingleNode(&quot;column&quot;)); &lt;br /&gt; &lt;br /&gt; xmlElement = XMLDocobj-&gt;CreateElement(&quot;column&quot;);&lt;br /&gt; xmlElement1 = XMLDocobj-&gt;CreateElement(&quot;heading&quot;);&lt;br /&gt; xmlElement1-&gt;InnerText = &quot;Sanat new&quot;;&lt;br /&gt; xmlElement-&gt;AppendChild(xmlElement1);&lt;br /&gt; xmlElement1 = XMLDocobj-&gt;CreateElement(&quot;prop&quot;);&lt;br /&gt; xmlElement1-&gt;InnerText = &quot;http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/Security&quot;;&lt;br /&gt; xmlElement-&gt;AppendChild(xmlElement1);&lt;br /&gt; xmlElement1 = XMLDocobj-&gt;CreateElement(&quot;type&quot;);&lt;br /&gt; xmlElement1-&gt;InnerText = &quot;string&quot;;&lt;br /&gt; xmlElement-&gt;AppendChild(xmlElement1);&lt;br /&gt; xmlElement1 = XMLDocobj-&gt;CreateElement(&quot;width&quot;);&lt;br /&gt; xmlElement1-&gt;InnerText = &quot;75&quot;;&lt;br /&gt; xmlElement-&gt;AppendChild(xmlElement1);  &lt;br /&gt;&lt;br /&gt; rootObj-&gt;InsertAfter(xmlElement,rootObj-&gt;SelectSingleNode(&quot;column&quot;)); &lt;br /&gt; if(XMLDocobj-&gt;InnerXml)&lt;br /&gt; {&lt;br /&gt;  return (BSTR)(VOID *)System::Runtime::InteropServices::Marshal::StringToBSTR(XMLDocobj-&gt;InnerXml);&lt;br /&gt; } &lt;br /&gt; return NULL;&lt;br /&gt;}</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/2791985870148156457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/2791985870148156457' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/2791985870148156457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/2791985870148156457'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/10/customize-outlook-message-inbox-view-vc.html' title='Customize Outlook message inbox View VC++ code'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-1484806674427512986</id><published>2009-10-16T11:02:00.000+05:30</published><updated>2009-10-16T11:28:05.925+05:30</updated><title type='text'>My different mode of poetry</title><content type='html'>Hi Evry one...I dont know why the hell I am going to write something here....but i love it 2 spread to all my frnd as a diwali wish......actally listen story wat happened...&lt;br /&gt;DAy - FRIDAY - 16-10-2009&lt;br /&gt;      Before 1 day to diawali&lt;br /&gt;&lt;br /&gt;came to my office n started orkut i sawa los of messages from my friend they -wre wishing me DIWALI...then i started replaying all of them and dere was sm other thing lk a line of poem running in my mind......then i thought i sud write 2 line in a different style to wish dem HAppy diwli....and i started writing but thing go beyound the 2 line i made it sm thng diff........................so here i am going to write.....for all my fiends.......&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&quot;Office ke kaam se tha pareshan.&lt;br /&gt; Kam khtam hone ka leta nahi naam,&lt;br /&gt; lyf thi boring n dil   hairan,&lt;br /&gt;&lt;br /&gt; baar baar khayalon me kuch tha shayed&lt;br /&gt; sayed ek chehra ya shyed koi naam,&lt;br /&gt;&lt;br /&gt; System ko liye baithe the,&lt;br /&gt; man nahi kar raha tha karne ka kaam,&lt;br /&gt; &lt;br /&gt;kuch to jarur tha mere around,&lt;br /&gt;mere liye nahi tha samjhana  aasan,&lt;br /&gt;&lt;br /&gt;arey 1 sec, tabhi yaad aaya,&lt;br /&gt;arey kal to hai Diawali ka tyohar,&lt;br /&gt;aur shyaed ho sath ek pyara mehman....&lt;br /&gt;&lt;br /&gt;bas kya tha maine tay kiya ki bhaiya,&lt;br /&gt;aaj jaldi jaldi khatam karo kaam,&lt;br /&gt;&lt;br /&gt;kal din bhar ki masti...aur &lt;br /&gt;sara din aaraaaammmmm.......&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;so all you guys hav fun fr d day and enjoy dis festiv season...........&lt;br /&gt;Happy diwali...............&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt; Sanat Kumar Ojha</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/1484806674427512986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/1484806674427512986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1484806674427512986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1484806674427512986'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/10/my-different-mode-of-poetry.html' title='My different mode of poetry'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-3808634023758987823</id><published>2009-10-12T11:56:00.000+05:30</published><updated>2009-10-12T12:06:15.610+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Date time string"/><category scheme="http://www.blogger.com/atom/ns#" term="GMT +5:30"/><category scheme="http://www.blogger.com/atom/ns#" term="System TIME in c"/><title type='text'>How to convert and print full system TIME string  in GMT or UTC</title><content type='html'>SYSTEMTIME tempSYSTIME;&lt;br /&gt;  SYSTEMTIME  stLocal;&lt;br /&gt;  FILETIME    LocalTime;&lt;br /&gt;  int  TmpMeetingInfoLength      = 0;&lt;br /&gt;  TCHAR tempStartTimeStr[MAX_PATH] ;&lt;br /&gt;   &lt;br /&gt;  TCHAR strDateandTime[MAX_PATH];&lt;br /&gt;  TIME_ZONE_INFORMATION info; &lt;br /&gt;  GetLocalTime(&amp;stLocal);&lt;br /&gt;  GetTimeZoneInformation(&amp;info); &lt;br /&gt;  LONG tmpval = info.Bias ;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;  if(info.Bias&lt;0)&lt;br /&gt;   tmpval = info.Bias * -1;&lt;br /&gt;  LONG hr , min ; &lt;br /&gt;  hr  = tmpval /60;&lt;br /&gt;  min = tmpval  % 60;&lt;br /&gt;  _TCHAR str[100]; &lt;br /&gt;  _stprintf(str, _T(&quot;: %02d-%02d-%02d  %02d:%02d:%02d GMT%s%02ld:%02ld&quot;),stLocal.wYear ,stLocal.wMonth, stLocal.wDay, &lt;br /&gt;   stLocal.wHour, stLocal.wMinute ,stLocal.wSecond , (info.Bias &gt; 0 &amp;&amp; info.Bias != 0 ) ?_T(&quot;-&quot;): _T(&quot;+&quot;),hr , min);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;OUTPUT : &quot;YYYY-MM-DD HH:MM:SS GMT+/- HH:MM&quot;&lt;br /&gt;eg: &quot;2009-10-10 23:15:01 GMT +05:30&quot;&lt;/strong&gt;</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/3808634023758987823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/3808634023758987823' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3808634023758987823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/3808634023758987823'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/10/how-to-convert-and-print-full-system.html' title='How to convert and print full system TIME string  in GMT or UTC'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-1122321196280667934</id><published>2009-08-31T18:47:00.001+05:30</published><updated>2009-08-31T18:58:01.559+05:30</updated><title type='text'>How To create PreProcessed File in VC++</title><content type='html'>To Create a preprocessed file u need to compile a file with Following command line argument.&lt;br /&gt;1 - CL /D [Macro ] (eg : _DEBUG) /EP /P filename(eg ....\123.c)&lt;br /&gt;&lt;br /&gt;it will generate a .i file with same file name (eg - 123.i)&lt;br /&gt;&lt;br /&gt;The qs is y do i need to create such a preprocessed file.&lt;br /&gt;I am a c++ developer but qnce i need to use some java file to compile written by other person with good coding style using #IFDEF and #endif macros&lt;br /&gt;that is not allowed in java so i was nt able to compile that file.then to compile that java file i need to first preprocess that file to remove this macros and then build the java file.&lt;br /&gt;&lt;br /&gt;then steps involved in that:&lt;br /&gt;1 - try to find out wht code need to seperate &lt;br /&gt;2 - write command with given preprocess variables checks&lt;br /&gt;3 compile it the u will get output inform of .i file&lt;br /&gt;rename it as the format it required(eg  .i to .java)&lt;br /&gt;&lt;br /&gt;Simplest way to get aal the required option for preprocessing&lt;br /&gt;if u r a .NET user&lt;br /&gt;Project or file setting enable the preprocessing optiopn &lt;br /&gt;prop - &gt; c++ -&gt;preprocess -&gt;&lt;br /&gt;&lt;br /&gt;rest ask qs if u hav prob.</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/1122321196280667934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/1122321196280667934' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1122321196280667934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1122321196280667934'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/08/how-to-create-preprocessed-file-in-vc.html' title='How To create PreProcessed File in VC++'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-1383559731013352217</id><published>2009-08-31T18:45:00.000+05:30</published><updated>2009-08-31T19:03:24.857+05:30</updated><title type='text'>Free Online Part Time Job</title><content type='html'>&lt;strong&gt;Work from Home. Earn Rs.2,000 daily. No Investment. Part Time Jobs.&lt;br /&gt;&lt;br /&gt;Wanted Online Internet job workers. Job is only through Internet. Work from home part time jobs. You can earn Rs.750-2000/- daily. These are genuine Data entry jobs &amp; Internet jobs. No Investment required. Only serious enquires please. For more details visit &lt;a&gt; &lt;a href=&quot;http://www.earnparttimejobs.com/index.php?id= 2392314&quot;&gt;http://www.earnparttimejobs.com/index.php?id= 2392314&lt;/a&gt; &lt;/a&gt;&lt;/strong&gt;</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/1383559731013352217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/1383559731013352217' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1383559731013352217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1383559731013352217'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/08/free-online-part-time-job.html' title='Free Online Part Time Job'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-8470037453806900476</id><published>2009-08-31T18:44:00.000+05:30</published><updated>2009-08-31T19:03:55.986+05:30</updated><title type='text'>How to Earn Rs.25000 every month without Investment through part time jobs?</title><content type='html'>&lt;strong&gt;How to Earn Rs.25000 every month without Investment through part time jobs?&lt;br /&gt;&lt;br /&gt;You can earn Rs.25000 very first month from data entry jobs on internet. This is an easy work from home form filling jobs. Work less than 1 hr daily. No investment. Please visit the website &lt;a&gt;&lt;a href=&quot;http://www.earnparttimejobs.com/index.php?id= 2392314&quot;&gt;http://www.earnparttimejobs.com/index.php?id= 2392314 &lt;/a&gt;&lt;/a&gt;&lt;/strong&gt;</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/8470037453806900476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/8470037453806900476' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/8470037453806900476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/8470037453806900476'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/08/how-to-earn-rs25000-every-month-without.html' title='How to Earn Rs.25000 every month without Investment through part time jobs?'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-181906807185126351</id><published>2009-08-05T00:55:00.000+05:30</published><updated>2011-10-15T23:36:44.463+05:30</updated><title type='text'>Way to start Programming.</title><content type='html'></content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/181906807185126351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/181906807185126351' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/181906807185126351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/181906807185126351'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/08/way-to-start-programming.html' title='Way to start Programming.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-404839252222259757</id><published>2009-07-30T18:16:00.000+05:30</published><updated>2009-08-05T00:49:00.072+05:30</updated><title type='text'>Simplest method to create COM object -VC++</title><content type='html'>Here i am going to write steps that i used to create a object of component and call the functions of that object.&lt;br /&gt;i was  just having the progid of that component and i supposed to call the function of that component.&lt;br /&gt;in VB it is very simple to do. u need to just call a function &quot;CreateObject(progID)&quot; and start wrking with that object.&lt;br /&gt;Eg:&lt;br /&gt;ProgId : abc.application.1&lt;br /&gt;dim obj = CreateObject(&quot;abc.application.1e&quot;);&lt;br /&gt; done.&lt;br /&gt;&lt;br /&gt;but in VC++ it is quite complicated to call the function or object creation.&lt;br /&gt;but lets see i have done the task.&lt;br /&gt;&lt;br /&gt;required header files:&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;windows.h&gt;&lt;br /&gt;#include &quot;Objbase.h&quot;&lt;br /&gt;&lt;br /&gt;CLSID clsid;&lt;br /&gt;	LPUNKNOWN punk;&lt;br /&gt;	LPDISPATCH pdisp;&lt;br /&gt;	OLECHAR FAR* szMember = _T(&quot;GetIpAddress&quot;);&lt;br /&gt;	DISPID dispid;&lt;br /&gt;	DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};&lt;br /&gt;&lt;br /&gt;	OleInitialize(NULL);// if OLE isn&#39;t already loaded.&lt;br /&gt;	CLSIDFromProgID(_T(&quot;abc.application.1&quot;), &amp;clsid);&lt;br /&gt;	CoCreateInstance(clsid, NULL, CLSCTX_SERVER,IID_IUnknown, (LPVOID FAR*)&amp;punk);&lt;br /&gt;	punk-&gt;QueryInterface(IID_IDispatch, (LPVOID FAR*)&amp;pdisp);&lt;br /&gt;	HRESULT  hresult = pdisp-&gt;GetIDsOfNames(IID_NULL,&amp;szMember  ,  1, LOCALE_SYSTEM_DEFAULT,   &amp;dispid);&lt;br /&gt; &lt;br /&gt;	 VARIANT FAR  pVarResult;&lt;br /&gt;	HRESULT  hresult2 = pdisp-&gt;Invoke(dispid,IID_NULL,LOCALE_SYSTEM_DEFAULT,DISPATCH_METHOD,&amp;dispparamsNoArgs, &amp;pVarResult, NULL, NULL);&lt;br /&gt;	::MessageBox(NULL,pVarResult.bstrVal,_T(&quot;GetIpAddress&quot;),0); &lt;br /&gt;	punk-&gt;Release();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;the above example follow the steps like&lt;br /&gt;1- get clsid of Componet from ProgID by using function &lt;br /&gt;   &lt;span style=&quot;font-style:italic;&quot;&gt;&lt;br /&gt;   CLSIDFromProgID(_T(&quot;abc.application.1&quot;), &amp;clsid);&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2 - get the object with outer most interface of the component as IUNKNOWN * (by which all the inner interfaces are derived.&lt;br /&gt;   &lt;span style=&quot;font-style:italic;&quot;&gt;CoCreateInstance(clsid, NULL, CLSCTX_SERVER,IID_IUnknown, (LPVOID FAR*)&amp;punk);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   CoCreateInstance is the API that is used to get the interface of the component.&lt;br /&gt;   CoCreateInstance involved lots of process of creating the object and getting the     iunknown interface.&lt;br /&gt;&lt;br /&gt;3.in this step we get the IDisaptch interface to interact with the function of the component.&lt;br /&gt;    &lt;br /&gt;   &lt;span style=&quot;font-style:italic;&quot;&gt;punk-&gt;QueryInterface(IID_IDispatch, (LPVOID FAR*)&amp;pdisp);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   here we have used the method queryinterface that is used to query the all inner     interface through the outer interface when IID of interface is known. &lt;br /&gt;&lt;br /&gt;4.  now the most important part that is calling method with dispatch interface.&lt;br /&gt;&lt;br /&gt;for this purpose we use two methods :&lt;br /&gt;&lt;br /&gt;    IDispatch::GetIDsOfNames&lt;br /&gt;    IDispatch::Invoke&lt;br /&gt;&lt;br /&gt;the first method is used to get the properties and methods of the component.&lt;br /&gt;and second method we used to call the function.&lt;br /&gt;&lt;br /&gt;    HRESULT  hresult = pdisp-&gt;GetIDsOfNames(IID_NULL,&amp;szMember  ,  1,            &lt;br /&gt;                       LOCALE_SYSTEM_DEFAULT,   &amp;dispid);&lt;br /&gt;szMember  contains the name of method that we are calling here.&lt;br /&gt;&lt;br /&gt;here dispid contains the array of the method or property.&lt;br /&gt;&lt;br /&gt;then call the invoke method by passing the value of dispid.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;more detail about the topic u can find under:&lt;br /&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms221479.aspx&quot;&gt; &lt;br /&gt; &lt;a href=&quot;href=&quot;http://msdn.microsoft.com/en-us/library/ms221306.aspx&quot;&gt;&lt;/a&gt;&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/404839252222259757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/404839252222259757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/404839252222259757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/404839252222259757'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/07/method-create-object-of-component-vc.html' title='Simplest method to create COM object -VC++'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-1087203928152532638</id><published>2009-07-23T18:28:00.000+05:30</published><updated>2009-07-23T18:45:17.667+05:30</updated><title type='text'>VC++ - Importent Outlook - Add in close</title><content type='html'>I was just working with Outlook 7 and made aVC++- ATL addin and things were very fine. for a moment i just shifted my code on Outlook 2003 the things gone changed ...suddenly my smile converted in deep worry becoz of in case of multiple instance i was not able to close all the explorer of outlook.outlook was not getting closed,was running behind. then after a lots of debug loops i found where exactly the problem........&lt;br /&gt;here i am goin to list some issues that may be a part of such problems while developin a com addin for outlook.&lt;br /&gt;1 - if u are registering any event (DispEventAdvise(.......)) with button or menu item just check   that its having corresponding un registeration(DispEventUnadvise(...........)).If DispEventAdvise   is coming in your code then there must be DispEventUnadvise(.....).&lt;br /&gt;2 - Arelease the explorer object that u r using.&lt;br /&gt;3 - free all the Com object that u r using.&lt;br /&gt;4 - always try to handle the events that  you are using in your addin case in a different class.&lt;br /&gt;&lt;br /&gt;Here i am giving example code as my .ccp file where i am handling my new explorer event....&lt;br /&gt;#include &quot;StdAfx.h&quot;&lt;br /&gt;#include &quot;ExplorerEventSink.h&quot;&lt;br /&gt;#include &quot;atlcom.h&quot;&lt;br /&gt; typedef IDispEventSimpleImpl&lt; href=&quot;outlook::ExplorerEvents_10&quot;&gt; Outlook::ExplorerEvents_10 )&gt; ExplorerCloseEvent;_ATL_FUNC_INFO ExplorerQuitInfo  = {CC_STDCALL,VT_EMPTY};&lt;br /&gt;CExplorerEventSink::CExplorerEventSink()  { mRefCount = 1;}CExplorerEventSink::~CExplorerEventSink(){ Uninitialize(); }&lt;br /&gt;HRESULT CExplorerEventSink::Initialize(CComPtr&lt;&lt;a href=&quot;outlook::_Explorer&quot;&gt;Outlook::_Explorer&lt;/a&gt;&gt; explorer){ HRESULT hResult = S_OK; i&lt;br /&gt;f( FAILED( hResult = ExplorerCloseEvent::DispEventAdvise( explorer))) &lt;br /&gt;return hResult;&lt;br /&gt; m_Explorer = explorer; return S_OK;}&lt;br /&gt;void CExplorerEventSink::Uninitialize()&lt;br /&gt;{   if( m_Explorer) {   ExplorerCloseEvent::DispEventUnadvise( m_Explorer); &lt;br /&gt; m_Explorer-&gt;Release(); &lt;br /&gt;m_Explorer = NULL; }}&lt;br /&gt;void __stdcall CExplorerEventSink::OnExplorerClose(){ delete this;}&lt;br /&gt;............&lt;br /&gt;write me if any spacific issue u are facing...&lt;br /&gt;we will try to handle together :)</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/1087203928152532638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/1087203928152532638' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1087203928152532638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1087203928152532638'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/07/vc-importent-outlook-add-in-close.html' title='VC++ - Importent Outlook - Add in close'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-1655591483841142601</id><published>2009-07-22T12:04:00.000+05:30</published><updated>2009-07-22T12:21:28.154+05:30</updated><title type='text'>Outlook add-in - multiple explorer of OL and Close Problems vc++</title><content type='html'>So now here i am going to write about the issues that came when i was developing the outlook add-in.&lt;br /&gt;1 - On outlook close issues:&lt;br /&gt;      Outlook never call begin shutdown(...) method while any of its resourece and object is in use and not properly released.so handle all the case while u are shutting down your add-in to ensure that your add-in released all outlook objects and resources.&lt;br /&gt;eg... before closing ensure all the explorer object that u have used for your add-in, has properly released.&lt;br /&gt;2. Stop all the threads that are runnng inside your addin before outlook close.&lt;br /&gt;3 . In case of multiple explorer of outlook bimd each explorer close event so that it would be          easier to realease particular explrer object on its close.&lt;br /&gt;4. In case of multiple explorer  first un advise the previous events and then advise new event.&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;HRESULT hr; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;hr = BrechaMeetingButtonEvents::DispEventUnadvise ((IDispatch*)     m_spMeetingButton[m_ExpCount -   1]); //BRECHA_LOG(&quot; DispEventAdvise((IDispatch*)m_spMeetingButton);&quot;);   &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;hr = BrechaMeetingMenuEvents::DispEventUnadvise ((IDispatch*)m_spMeetingMenuItem[m_ExpCount - 1]);  //BRECHA_LOG(&quot;DispEventAdvise((IDispatch*)m_spMeetingMenuItem);&quot;); &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;//MessageBox(0,_T(&quot;Explorer Event&quot;),_T(&quot;Office&quot;),0);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt; CComPtr&lt;&lt;/span&gt;&lt;a href=&quot;outlook::_Explorer&quot;&gt;spExplorer&quot;&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;Outlook::_Explorer&gt;spExplorer&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;; pDisp-&gt;QueryInterface(__uuidof(IDispatch), (LPVOID*)&amp;amp;spExplorer); m_spExplorer = spExplorer; m_spExplorer-&gt;Activate(); &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;if(m_spExplorer) { &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt; BrechaErrorType errCode = AddMeetingButton();  &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;  hr = BrechaMeetingButtonEvents::DispEventAdvise((IDispatch*)m_spMeetingButton[m_ExpCount]);  BRECHA_LOG(&quot; DispEventAdvise((IDispatch*)m_spMeetingButton);&quot;); &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt; if(m_OLVer_A &gt;= 12)  {   errCode = AddMeetingMenuItem();   &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;if(errCode == S_OK)   &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt; hr = BrechaMeetingMenuEvents::DispEventAdvise((IDispatch*)m_spMeetingMenuItem[m_ExpCount]);    BRECHA_LOG(&quot;DispEventAdvise((IDispatch*)m_spMeetingMenuItem);&quot;);  &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt; m_ExpCount++; }&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/1655591483841142601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/1655591483841142601' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1655591483841142601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/1655591483841142601'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/07/outlook-add-in-multiple-explorer-of-ol.html' title='Outlook add-in - multiple explorer of OL and Close Problems vc++'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6818787173148484199.post-4505399391503772738</id><published>2009-03-04T14:08:00.000+05:30</published><updated>2009-03-04T14:27:32.546+05:30</updated><title type='text'>MS Office Addin creation and related info in vc++</title><content type='html'>&lt;a id=&quot;3&quot;&gt;This article describes how to create a simple, compiled add-in that inserts the current date and time at the insertion point. In this article, you create and install an add-in project, load the add-in, and integrate the add-in in the Visual Studio .NET or Visual Studio 2005 interface.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Requirements &lt;/strong&gt;&lt;br /&gt;The following list outlines the recommended hardware, software, network infrastructure, and service packs that you must have:&lt;br /&gt;Microsoft Visual Studio .NET or Microsoft Visual Studio 2005&lt;br /&gt;Microsoft Windows 2000 Professional, Microsoft Windows Server 2003, Microsoft Windows 2000 Server, Microsoft Windows XP Professional, Microsoft Windows XP Server with the Microsoft .NET Framework&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;On Connection &lt;/strong&gt;&lt;br /&gt;The OnConnection event fires whenever the COM add-in is connected. The add-in may be connected on startup, by the end user, or through Automation. If OnConnection returns successfully, the add-in is said to be loaded. If an error message is returned, the host application immediately releases its reference to the add-in, and the object is destroyed. OnConnection takes the following four parameters:&lt;br /&gt;Application - A reference to the host application object.&lt;br /&gt;ConnectMode - A constant that specifies how the add-in is connected. The add-in can be connected in the following ways:&lt;br /&gt;ext_cm_AfterStartup - The add-in is started by the end user from the COM Add-ins dialog box.&lt;br /&gt;ext_cm_CommandLine - The add-in is connected from the command line. Note that this does not apply to building COM add-ins for Office applications.&lt;br /&gt;ext_cm_External - The add-in is connected by an external application through Automation. Note that this does not apply to building COM add-ins for Office applications.&lt;br /&gt;ext_cm_Startup - The add-in is started by the host at application startup. This behavior is controlled by a setting in the registry.&lt;br /&gt;AddInInst - A reference to the COMAddIn object that refers to this add-in in the COMAddIns collection for the host application.&lt;br /&gt;Custom - An array of Variant type values that can hold user-defined data.&lt;br /&gt;&lt;a id=&quot;4&quot;&gt;&lt;/a&gt;OnDisconnection&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;OnDisconnection&lt;/strong&gt;&lt;br /&gt;The OnDisconnection event fires when the COM add-in is disconnected and just before it unloads from memory. The add-in should perform any cleanup of resources in this event and should restore any changes made to the host application. OnDisconnection takes the following two parameters:&lt;br /&gt;RemoveMode - A constant that specifies how the add-in was disconnected. The add-in can be disconnected in the following ways:&lt;br /&gt;ext_dm_HostShutdown - The add-in is disconnected when the host application closed.&lt;br /&gt;ext_dm_UserClosed - The add-in is disconnected by the end user or an Automation controller.&lt;br /&gt;Custom - An array of Variant type values that can hold user-defined data.&lt;br /&gt;&lt;a id=&quot;5&quot;&gt;&lt;/a&gt;&lt;strong&gt;OnAddInsUpdate &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The OnAddInsUpdate event fires when the set of registered COM add-ins changes. In other words, whenever a COM add-in is installed or removed from the host application, this event fires.&lt;br /&gt;&lt;a id=&quot;6&quot;&gt;&lt;/a&gt;OnStartupComplete and OnBeginShutdown&lt;br /&gt;loadTOCNode(3, &#39;summary&#39;);&lt;br /&gt;&lt;br /&gt;Both the OnStartupComplete and the OnBeginShutdown methods are called when the host application has left or is entering a state in which user interaction should be avoided because the application is busy loading or unloading itself from memory. OnStartupComplete is only called if the add-in was connected during startup, and OnBeginShutdown is only called if the host disconnects the add-in during shutdown. Because the user interface for the host application is fully active when these events fire, they may be the only way to perform certain actions that otherwise would be unavailable from OnConnection and OnDisconnection.&lt;br /&gt;&lt;a href=&quot;http://support.microsoft.com/kb/302896#top&quot;&gt; &lt;/a&gt;&lt;br /&gt;&lt;a id=&quot;7&quot;&gt;&lt;/a&gt;&lt;strong&gt;COM Add-in Registration&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In addition to normal COM registration, a COM add-in needs to register itself with each Office application in which it runs. To register itself with a particular application, the add-in should create a subkey, using its ProgID as the name for the key, under the following location:&lt;br /&gt;HKEY_CURRENT_USER\Software\Microsoft\Office\OfficeApp\Addins\ProgIDThe add-in can provide values at this key location for both a friendly display name and a full description. In addition, the add-in should specify its desired load behavior by using a DWORD value called LoadBehavior. This value determines how the add-in is loaded by the host application, and is made up of a combination of the following values:&lt;br /&gt;0 = Disconnect - Is not loaded.&lt;br /&gt;1 = Connected - Is loaded.&lt;br /&gt;2 = Bootload - Load on application startup.&lt;br /&gt;8 = DemandLoad - Load only when requested by user.&lt;br /&gt;16 = ConnectFirstTime - Load only once (on next startup).The typical value specified is 0x03 (Connected Bootload). Add-ins that implement IDTExtensibility2 should also specify a DWORD value called CommandLineSafe to indicate whether the add-ins are safe for operations that do not support a user interface. A value of 0x00 indicates False, and a value of 0x01 indicates True.&lt;br /&gt;&lt;a href=&quot;http://support.microsoft.com/kb/302896#top&quot;&gt; &lt;/a&gt;&lt;br /&gt;&lt;a id=&quot;8&quot;&gt;&lt;/a&gt;How to Build a COM Add-in by Using Visual Basic .NET&lt;br /&gt;loadTOCNode(2, &#39;summary&#39;);&lt;br /&gt;&lt;br /&gt;As mentioned earlier, an Office COM add-in is an in-process COM server that is activated by an Office application through the COM run-time layer. Therefore, developing a COM add-in in Visual Basic .NET requires that the add-in component be implemented in .NET and then exposed to the COM clients (that is, the Office applications) through the COM interop layer.To create a COM add-in in Visual Basic .NET, follow these steps:&lt;br /&gt;In Visual Basic .NET, create a Class Library project.&lt;br /&gt;Add a reference to the type library that implements IDTExtensibility2. The primary interop assembly for this is already available under the name Extensibility.&lt;br /&gt;Add a reference to the Microsoft Office object library. The primary interop assembly for this is already available under the name Office.&lt;br /&gt;Create a public class in the class library that implements IDTExtensibility2.&lt;br /&gt;After the class library is built, register the library for COM interop. To do this, generate a strong named assembly for this class library and then register it with COM interop. You can use Regasm.exe to register a .NET component for COM interop.&lt;br /&gt;Create registry entries so that Office applications can recognize and load the add-in.You can choose to complete all of these steps, or you can create a .NET project of type Shared Addin. This starts the Extensibility Wizard, which helps you to create a COM add-in in .NET. The Extensibility Wizard creates a Visual Basic .NET class library project along with a Connect class that implements the IDTExtensibility2 interface. The skeleton code that implements the empty members of IDTExtensibility is also generated. This project has references to Extensibility and Office assemblies. The build settings of the project have Register for COM Interop selected. The assembly key (.snk) file is generated and is referenced in the AssemblyKeyfile attribute in Assemblyinfo.vb. Along with the class library project, the wizard generates a setup project that you can use to deploy the COM add-in on other computers. You may remove this project if desired.</content><link rel='replies' type='application/atom+xml' href='http://simplecodewithsanat.blogspot.com/feeds/4505399391503772738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6818787173148484199/4505399391503772738' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/4505399391503772738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6818787173148484199/posts/default/4505399391503772738'/><link rel='alternate' type='text/html' href='http://simplecodewithsanat.blogspot.com/2009/03/ms-office-addin-creation-and-related.html' title='MS Office Addin creation and related info in vc++'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14395209970031326065</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>