|
Hi,
If stream is a serialized version of structure, and its size and alignment is as it would be in the structure, you can use memcpy(dest, src, size) function.
For example:
...
SYSTEMTIME st;
GetSystemTime(&st);
DWORD dwSize = sizeof(SYSTEMTIME);
BYTE *pBuf = new BYTE[dwSize];
if (!pBuf)
return -1;
memcpy(pBuf, &st, dwSize);
memcpy(&st, pBuf, dwSize);
...
Hope that helps a bit...
Best regards
|
|
|
|
|
hello,
I am in trouble with parsing xml containing dataset data with xsl.
It worked ok if I saved the xml as file on disk, but fails if I want to do it in 'memory', the xsl cannot find the root element named Sales..., it does not find any items.
The c# code:
XslTransform xslTran = new XslTransform();
string xslPath=(string)this.configurationAppSettings.GetValue("EstInvoicePath",typeof (string));
xslTran.Load(xslPath); // loads the xsl
StringWriter swr = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(swr);
System.Xml.XmlWriter wx=xtw;
Store.Sales.WriteXml(wx,System.Data.XmlWriteMode.IgnoreSchema);
StringReader sr = new StringReader(swr.ToString());
System.Xml.XmlTextReader xtr= new XmlTextReader(sr);
System.Xml.XmlReader xr=xtr;
System.Xml.XPath.XPathDocument doc2= new System.Xml.XPath.XPathDocument(xr,System.Xml.XmlSpace.None);
xslTran.Transform(doc2.CreateNavigator(),null,w);
string textMy=sw.ToString();
the xsl fragment for testing: (Sales should be a root element)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance/" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:s="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="ms s xsi xsd">
<xsl:output method="html"/>
<xsl:template match="/">
<table>
<tr>
<td>
<img src="gfx/InvoiceLogo.bmp" border="0"/>
</td>
</tr>
<xsl:for-each select="Sales/SlsItem">
<tr>
<td>one Item found</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Can anybody give a hint please...?
|
|
|
|
|
if you have a C# code you can ask your question on C$ forum maybe you get your answer
|
|
|
|
|
Thank you, I solved my problem alredy with System.Xml.XmlNamespaceManager.
|
|
|
|
|
hi,
my query is like this
if(!recset1.Open( CRecordset::forwardOnly,
_T( "SELECT Controller_Name FROM T_controller WHERE Port_ID='0'") ,CRecordset::readOnly))
I want that my condition WHERE become a parameter WHERE Port_ID=str
how can i do this
thanks
|
|
|
|
|
so I tried this
wsprintf(szBuffer,"SELECT Controller_Name FROM T_controller WHERE Port_ID='0'");
if(!recset1.Open( CRecordset::forwardOnly,
szBuffer ,CRecordset::readOnly))
but when i change Port_ID='0' with Port_ID=str I have a problem when running the programm
I declare CString str="0"
|
|
|
|
|
use CString::Format() .
you first format the string (sql query) with the parameters it has to receive, and then forward it...
|
|
|
|
|
sorry but I don't understand
|
|
|
|
|
wsprintf(szBuffer, _T("SELECT Controller_Name FROM T_controller WHERE Port_ID='%s'"), str);
|
|
|
|
|
I agree with tocct why you dont use of CString::Format
|
|
|
|
|
Regardless of whether CString::Format() or sprintf() is used, it has to be used correctly. Simply shoving MFC at the problem is not an automatic fix.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi DavidCrow,
how are you
Generaly I dont use from wsprintf because:
From the MSDN
"Security Alert Using this function incorrectly can compromise the security of your application"
|
|
|
|
|
Hi,
call to "COleDateTime::GetCurrentTime()" get crashed in my MFC aplication.
I am using Windows XP, SP2.
Development environment is Visual Studio 6 with Platform SDK for XP SP2.
Thanx in advance.
|
|
|
|
|
The following information is always helpful when diagnosing a crash:
- The type of exception generated.
- The machine code around the faulting instruction.
- The call stack to the faulting instruction.
- The source code around the faulting instruction.
Steve
|
|
|
|
|
I second stephen on this.
Give some code.
|
|
|
|
|
VCSharp007 wrote: "COleDateTime::GetCurrentTime()" get crashed in my MFC aplication
COleDateTime::GetCurrentTime() has an issue since it uses the underlying time_t type for returning time. Now when year 2038 jan happens time_t reaches it's limit hence wraps around.
Instead of COleDateTime::GetCurrentTime() try using GetLocalTime . GetLocalTime returns local system time based on your timezone.
This is could be the problem.
More info[^]
|
|
|
|
|
Nibu babu thomas wrote: This is could be the problem.
How, since we are roughly 32 years away?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: How, since we are roughly 32 years away?
Yeah true. But our client tested our product with year greater than 2038 to see if such issues are handled properly. Hence I thought this could be the problem, since our application crashed when it was tested like this.
|
|
|
|
|
Nibu babu thomas wrote: COleDateTime::GetCurrentTime() has an issue since it uses the underlying time_t...
Actually it uses a DATE , which is a double . CTime has the year 2038 problem.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi,
Ensure that COleDateTime::GetCurrentTime() is not assigned directly to other variable than COleDateTime class type.
Try if this will throw an exception:
COleDateTime dateTime = COleDateTime::GetCurrentTime();
Best regards
|
|
|
|
|
Hi,
What is the VC++ Substitute for the MFC <code>SetIcon</code> function??
Thanx in Advance
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
I think you should look at DrawIcon() /LoadIcon()
SetClassLong(): Your application can replace a class icon by using the SetClassLong function.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Use the WM_SETICON message.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
For a static control, send it a STM_SETICON message. For a button, send it a BM_SETIMAGE message. For all others, send them a WM_SETICON message.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|