<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>CodeGuru Forums</title>
		<link>http://forums.codeguru.com</link>
		<description>Hard hitting articles, dicussions, resources, and more all focusing for real developers in the real world.</description>
		<language>en</language>
		<lastBuildDate>Wed, 16 May 2012 21:08:11 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://forums.codeguru.com/images/misc/rss.jpg</url>
			<title>CodeGuru Forums</title>
			<link>http://forums.codeguru.com</link>
		</image>
		<item>
			<title>C# Properties Question</title>
			<link>http://forums.codeguru.com/showthread.php?t=523847&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 18:33:43 GMT</pubDate>
			<description><![CDATA[Hello, I am an intermediate Java programmer and I have some questions about Properties that I cannot find anywhere. From what I gather, they are similar to Java's getter and setter methods, but seem like they may be more powerful. 


Code:
---------

private string color; 

public string Color
{
    get 
    {
        return color.ToUpper(); 
    }
    set 
    { 
        if(value == "Red")
            color = value; 
        else
            Console.WriteLine("This car can only be red!");
    }
}
---------
This allows you to set the private string color to any string. I am just curious about how you would call such a method? How you differentiate between setting and getting when you make the call. Where is the variable "value" coming from? 

Just some things that I would like to clarify before I move on. Thank you for any help.]]></description>
			<content:encoded><![CDATA[<div>Hello, I am an intermediate Java programmer and I have some questions about Properties that I cannot find anywhere. From what I gather, they are similar to Java's getter and setter methods, but seem like they may be more powerful. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><br />
private string color; <br />
<br />
public string Color<br />
{<br />
&nbsp; &nbsp; get <br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return color.ToUpper(); <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; set <br />
&nbsp; &nbsp; { <br />
&nbsp; &nbsp; &nbsp; &nbsp; if(value == &quot;Red&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; color = value; <br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;This car can only be red!&quot;);<br />
&nbsp; &nbsp; }<br />
}</code><hr />
</div>This allows you to set the private string color to any string. I am just curious about how you would call such a method? How you differentiate between setting and getting when you make the call. Where is the variable &quot;value&quot; coming from? <br />
<br />
Just some things that I would like to clarify before I move on. Thank you for any help.</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=11">C-Sharp Programming</category>
			<dc:creator>Wnt2bsleepin</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523847</guid>
		</item>
		<item>
			<title>C Dynamic Memory Allocation Error</title>
			<link>http://forums.codeguru.com/showthread.php?t=523837&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 18:01:32 GMT</pubDate>
			<description><![CDATA[Hi Gurus,

Trying to append a comma to a string. Getting "Segmentation Error" on Solaris *when the function is entered the second time.*


Code:
---------

// Appends a comma to the given string
void appendComma(char* instring)
{
	if (instring == NULL)
	{	
		instring = realloc(NULL, strlen(","));
		strcpy(instring,",");
	}
	else
	{	
		instring = realloc(instring, strlen(instring) + strlen(",")); // ===> Segmentation error here
		strcat(instring,",");
	}		
}
---------
Your help is alwasy appreciated.]]></description>
			<content:encoded><![CDATA[<div>Hi Gurus,<br />
<br />
Trying to append a comma to a string. Getting &quot;Segmentation Error&quot; on Solaris <b>when the function is entered the second time.</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><br />
// Appends a comma to the given string<br />
void appendComma(char* instring)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (instring == NULL)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; instring = realloc(NULL, strlen(&quot;,&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strcpy(instring,&quot;,&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; instring = realloc(instring, strlen(instring) + strlen(&quot;,&quot;)); // ===&gt; Segmentation error here<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strcat(instring,&quot;,&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
}</code><hr />
</div>Your help is alwasy appreciated.</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=9">C++  (Non Visual C++ Issues)</category>
			<dc:creator>kaftab</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523837</guid>
		</item>
		<item>
			<title>C2712: Cannot use __try in functions that require object unwinding</title>
			<link>http://forums.codeguru.com/showthread.php?t=523832&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 17:43:59 GMT</pubDate>
			<description>Hello,

I am migrating a software writen with VC++ 6.0 to VS 2010/VC++2010. and I have a project which does not compile in Debug mode. I have:


Code:
---------
LBSC_AppUserInfoList *			
LBSC_Session::GetUsersInfo( const LBSC_Ticket *pTicket )
{
	TSROut_GetUsersInfo	sOut;
	C_Buffer			*pcbRet = NULL;
	TSRIn_TicketPar		InPar;
//...
	ClntFree( (void *)sOut.szBuffer );  // dealoca o que veio do RPC

	return( pList );
} // C2712 - Cannot use __try in functions that require object unwinding
---------
and I haven´t any mention to __try

do you undestand?</description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am migrating a software writen with VC++ 6.0 to VS 2010/VC++2010. and I have a project which does not compile in Debug mode. I have:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">LBSC_AppUserInfoList *&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
LBSC_Session::GetUsersInfo( const LBSC_Ticket *pTicket )<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; TSROut_GetUsersInfo&nbsp; &nbsp; &nbsp; &nbsp; sOut;<br />
&nbsp; &nbsp; &nbsp; &nbsp; C_Buffer&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *pcbRet = NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; TSRIn_TicketPar&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InPar;<br />
//...<br />
&nbsp; &nbsp; &nbsp; &nbsp; ClntFree( (void *)sOut.szBuffer );&nbsp; // dealoca o que veio do RPC<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return( pList );<br />
} // C2712 - Cannot use __try in functions that require object unwinding</code><hr />
</div>and I haven´t any mention to __try<br />
<br />
do you undestand?</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=7">Visual C++ Programming</category>
			<dc:creator>michaelhsilva</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523832</guid>
		</item>
		<item>
			<title>Sending Data to Excel with C++</title>
			<link>http://forums.codeguru.com/showthread.php?t=523831&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 14:35:13 GMT</pubDate>
			<description><![CDATA[Hi folks,

I'm working on a program that reads a text file which has columns of dates, times and associated values, then sends the columns to an excel sheet. The entire file follows the same pattern.

Text file sample:


Code:
---------
2012-05-14 14:08:12.498 8 InfoMSG1   N  2.719  7.117 11.335 12.795 16.228 16.619 18.117 19.608 20.899   6883      0   2994   2153   2089      0 {InfoMSG2}
2012-08-14 14:08:38.644 8 InfoMSG3 N  2.974  6.732  9.577 10.596 13.355 13.737 14.871 16.327 17.641   7142      0   1399   1709   1637      0 {InfoMSG4}
---------
At the moment, I'm using a fairly inelegant solution of breaking each sentence into tokens delimited by whitespace and storing each column in a separate array as follows:


Code:
---------
	string			line;
	string			*col1, *col2, *col4, *col5, *col21;		

        col1 = new string[fileLength];
	col2 = new string[fileLength];
	col3 = new LONG[fileLength];
	col4 = new string[fileLength];
	col5 = new string[fileLength];
	col6 = new FLOAT[fileLength];
	col7 = new FLOAT[fileLength];
	col8 = new FLOAT[fileLength];
	col9 = new FLOAT[fileLength];
	col10 = new FLOAT[fileLength];
	col11 = new FLOAT[fileLength];
	col12 = new FLOAT[fileLength];
	col13 = new FLOAT[fileLength];
	col14 = new FLOAT[fileLength];
	col15 = new FLOAT[fileLength];
	col16 = new FLOAT[fileLength];
	col17 = new FLOAT[fileLength];
	col18 = new FLOAT[fileLength];
	col19 = new FLOAT[fileLength];
	col20 = new FLOAT[fileLength];
	col21 = new string[fileLength];

while(getline(file, line))
	{
		std::stringstream	linestream(line);
				
		//Reading space separated columns into string arrays
		linestream >> col1[i] >> col2[i] >> col3[i] >> col4[i] >> col5[i] >> col6[i] >> col7[i] >> col8[i] >> col9[i] >> col10[i] >> col11[i];
		linestream >> col11[i] >> col13[i] >> col14[i] >> col15[i] >> col16[i] >> col17[i] >> col18[i] >> col19[i] >> col20[i] >> col21[i];

		i++;
	}
---------
In my research of the COM interface process from C++ to Excel I haven't been able to find a method of passing single byte strings to excel. The only method I've been able to have any success with is detailed in this MSDN article - http://support.microsoft.com/kb/216686

It uses a VARIANT safearray to pass data to Excel, and the only way I can see to use my arrays as above is to convert the std::strings in each element first to wstrings, then to BSTR.

I would think there's probably a better way to do this conversion but haven't come up with one.

Anyway, my conversion form single byte to wide string is achieved using the following function:


Code:
---------
wstring stws(const string &src_string)
{
	size_t src_len = src_string.length();

	if(0 == src_len)
		return L"";

	wchar_t *buf = new(std::nothrow) wchar_t[src_len + 1];

	if(0 == buf)
		return L"";

	mbstowcs(buf, src_string.c_str(), src_len);
	buf[src_len] = L'\0';

	wstring final_string = buf;

	if(0 != buf)
		delete [] buf;

	return final_string;
}
---------
The further conversion from wide string to BSTR is carried out like so:


Code:
---------
	
	wcol1 = new wstring[fileLength];
	wcol2 = new wstring[fileLength];
	wcol4 = new wstring[fileLength];
	wcol5 = new wstring[fileLength];
	wcol21 = new wstring[fileLength];

	bcol1 = new BSTR[fileLength];
	bcol2 = new BSTR[fileLength];
	bcol4 = new BSTR[fileLength];
	bcol5 = new BSTR[fileLength];
	bcol21 = new BSTR[fileLength];

for(int i=0; i<10; i++)
	{
		wcol1[i] = stws(col1[i]);
		wcol2[i] = stws(col2[i]);
		wcol4[i] = stws(col4[i]);
		wcol5[i] = stws(col5[i]);
		wcol21[i] = stws(col21[i]);

		bcol1[i] = SysAllocString(wcol1[i].c_str());
		bcol2[i] = SysAllocString(wcol1[i].c_str());
		bcol4[i] = SysAllocString(wcol1[i].c_str());
		bcol5[i] = SysAllocString(wcol1[i].c_str());
		bcol21[i] = SysAllocString(wcol1[i].c_str());
	}
---------
I've printed the BSTR values to the console using wcout to confirm that they are correct. 

Now, to pass this data into an excel sheet. I'm using the method outlined in the MSDN article linked above, creating a safe array with my list of values from the BSTR arrays:


Code:
---------
	
// Create a safearray of variants...
	VARIANT arr;
	arr.vt = VT_ARRAY | VT_VARIANT;
	{
		SAFEARRAYBOUND sab[2];
		sab[0].lLbound = 1; sab[0].cElements = 10;
		sab[1].lLbound = 1; sab[1].cElements = 1;
		arr.parray = SafeArrayCreate(VT_VARIANT, 2, sab);
	}

// Fill safearray with some values...
	for(int i=0; i<10; i++) {
		for(int j=0; j<2; j++) {
			// Create entry value for (i,j)
			VARIANT tmp;
			tmp.vt = VT_BSTR;
			tmp.bstrVal = bcol2[i];
			// Add to safearray...
			long indices[] = {i,j};
			SafeArrayPutElement(arr.parray, indices, (void *)&tmp);
		}
	}
---------

Then I do the usual COM tasks, creating a new Workbook, acquiring  the Active Worksheet, getting a range object, before setting the values in the range as follows:


Code:
---------
	
// Set range with our safearray...
	AutoWrap(DISPATCH_PROPERTYPUT, NULL, pXlRange, L"Value", 1, arr);
---------
For the scenario described above, where I only copy a single column to excel at a time, what I have does the trick. 

My major problem at this stage is finding a way to loop in the two dimensions of the safearray to copy the rest of the columns at the same time. I know I can do it by creating a safearray for each column following a similarly inelegant approach to how I dealt with splitting the data into columns in the first place, but I'm sure there's a better way to do it than that.

Any help would be greatly appreciated, ty.]]></description>
			<content:encoded><![CDATA[<div>Hi folks,<br />
<br />
I'm working on a program that reads a text file which has columns of dates, times and associated values, then sends the columns to an excel sheet. The entire file follows the same pattern.<br />
<br />
Text file sample:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">2012-05-14 14:08:12.498 8 InfoMSG1&nbsp;  N&nbsp; 2.719&nbsp; 7.117 11.335 12.795 16.228 16.619 18.117 19.608 20.899&nbsp;  6883&nbsp; &nbsp; &nbsp; 0&nbsp;  2994&nbsp;  2153&nbsp;  2089&nbsp; &nbsp; &nbsp; 0 {InfoMSG2}<br />
2012-08-14 14:08:38.644 8 InfoMSG3 N&nbsp; 2.974&nbsp; 6.732&nbsp; 9.577 10.596 13.355 13.737 14.871 16.327 17.641&nbsp;  7142&nbsp; &nbsp; &nbsp; 0&nbsp;  1399&nbsp;  1709&nbsp;  1637&nbsp; &nbsp; &nbsp; 0 {InfoMSG4}</code><hr />
</div>At the moment, I'm using a fairly inelegant solution of breaking each sentence into tokens delimited by whitespace and storing each column in a separate array as follows:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&nbsp; &nbsp; &nbsp; &nbsp; string&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; string&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *col1, *col2, *col4, *col5, *col21;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; col1 = new string[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col2 = new string[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col3 = new LONG[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col4 = new string[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col5 = new string[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col6 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col7 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col8 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col9 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col10 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col11 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col12 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col13 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col14 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col15 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col16 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col17 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col18 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col19 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col20 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; col21 = new string[fileLength];<br />
<br />
while(getline(file, line))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::stringstream&nbsp; &nbsp; &nbsp; &nbsp; linestream(line);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Reading space separated columns into string arrays<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; linestream &gt;&gt; col1[i] &gt;&gt; col2[i] &gt;&gt; col3[i] &gt;&gt; col4[i] &gt;&gt; col5[i] &gt;&gt; col6[i] &gt;&gt; col7[i] &gt;&gt; col8[i] &gt;&gt; col9[i] &gt;&gt; col10[i] &gt;&gt; col11[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; linestream &gt;&gt; col11[i] &gt;&gt; col13[i] &gt;&gt; col14[i] &gt;&gt; col15[i] &gt;&gt; col16[i] &gt;&gt; col17[i] &gt;&gt; col18[i] &gt;&gt; col19[i] &gt;&gt; col20[i] &gt;&gt; col21[i];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</code><hr />
</div>In my research of the COM interface process from C++ to Excel I haven't been able to find a method of passing single byte strings to excel. The only method I've been able to have any success with is detailed in this MSDN article - <a rel="nofollow" href="http://support.microsoft.com/kb/216686" target="_blank">http://support.microsoft.com/kb/216686</a><br />
<br />
It uses a VARIANT safearray to pass data to Excel, and the only way I can see to use my arrays as above is to convert the std::strings in each element first to wstrings, then to BSTR.<br />
<br />
I would think there's probably a better way to do this conversion but haven't come up with one.<br />
<br />
Anyway, my conversion form single byte to wide string is achieved using the following function:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">wstring stws(const string &amp;src_string)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; size_t src_len = src_string.length();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(0 == src_len)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return L&quot;&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wchar_t *buf = new(std::nothrow) wchar_t[src_len + 1];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(0 == buf)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return L&quot;&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; mbstowcs(buf, src_string.c_str(), src_len);<br />
&nbsp; &nbsp; &nbsp; &nbsp; buf[src_len] = L'\0';<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wstring final_string = buf;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(0 != buf)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delete [] buf;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return final_string;<br />
}</code><hr />
</div>The further conversion from wide string to BSTR is carried out like so:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol1 = new wstring[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol2 = new wstring[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol4 = new wstring[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol5 = new wstring[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol21 = new wstring[fileLength];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol1 = new BSTR[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol2 = new BSTR[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol4 = new BSTR[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol5 = new BSTR[fileLength];<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol21 = new BSTR[fileLength];<br />
<br />
for(int i=0; i&lt;10; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wcol1[i] = stws(col1[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wcol2[i] = stws(col2[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wcol4[i] = stws(col4[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wcol5[i] = stws(col5[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wcol21[i] = stws(col21[i]);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bcol1[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bcol2[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bcol4[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bcol5[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bcol21[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</code><hr />
</div>I've printed the BSTR values to the console using wcout to confirm that they are correct. <br />
<br />
Now, to pass this data into an excel sheet. I'm using the method outlined in the MSDN article linked above, creating a safe array with my list of values from the BSTR arrays:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&nbsp; &nbsp; &nbsp; &nbsp; <br />
// Create a safearray of variants...<br />
&nbsp; &nbsp; &nbsp; &nbsp; VARIANT arr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; arr.vt = VT_ARRAY | VT_VARIANT;<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SAFEARRAYBOUND sab[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sab[0].lLbound = 1; sab[0].cElements = 10;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sab[1].lLbound = 1; sab[1].cElements = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arr.parray = SafeArrayCreate(VT_VARIANT, 2, sab);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
// Fill safearray with some values...<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i=0; i&lt;10; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int j=0; j&lt;2; j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create entry value for (i,j)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VARIANT tmp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmp.vt = VT_BSTR;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmp.bstrVal = bcol2[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Add to safearray...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long indices[] = {i,j};<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SafeArrayPutElement(arr.parray, indices, (void *)&amp;tmp);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</code><hr />
</div><br />
Then I do the usual COM tasks, creating a new Workbook, acquiring  the Active Worksheet, getting a range object, before setting the values in the range as follows:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&nbsp; &nbsp; &nbsp; &nbsp; <br />
// Set range with our safearray...<br />
&nbsp; &nbsp; &nbsp; &nbsp; AutoWrap(DISPATCH_PROPERTYPUT, NULL, pXlRange, L&quot;Value&quot;, 1, arr);</code><hr />
</div>For the scenario described above, where I only copy a single column to excel at a time, what I have does the trick. <br />
<br />
My major problem at this stage is finding a way to loop in the two dimensions of the safearray to copy the rest of the columns at the same time. I know I can do it by creating a safearray for each column following a similarly inelegant approach to how I dealt with splitting the data into columns in the first place, but I'm sure there's a better way to do it than that.<br />
<br />
Any help would be greatly appreciated, ty.</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=7">Visual C++ Programming</category>
			<dc:creator>chopshardiman</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523831</guid>
		</item>
		<item>
			<title><![CDATA[form doesn't show properly]]></title>
			<link>http://forums.codeguru.com/showthread.php?t=523830&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 14:21:24 GMT</pubDate>
			<description>deleted</description>
			<content:encoded><![CDATA[<div>deleted</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=11">C-Sharp Programming</category>
			<dc:creator>c94wjpn</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523830</guid>
		</item>
		<item>
			<title>Remote Debugging in Visual Basic 6.0</title>
			<link>http://forums.codeguru.com/showthread.php?t=523827&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 13:21:44 GMT</pubDate>
			<description><![CDATA[:wave:Hello everybody!!

I want to debug my visual basic 6.0 application on the remote computer.

For example:
The application and the visual studio 6.0 are existing in computer nr.1, but the result's from debugging I want to see on another computer for example computer nr.2, which is connected on the same LAN network.

please help]]></description>
			<content:encoded><![CDATA[<div>:wave:Hello everybody!!<br />
<br />
I want to debug my visual basic 6.0 application on the remote computer.<br />
<br />
For example:<br />
The application and the visual studio 6.0 are existing in computer nr.1, but the result's from debugging I want to see on another computer for example computer nr.2, which is connected on the same LAN network.<br />
<br />
please help</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=4">Visual Basic 6.0 Programming</category>
			<dc:creator>acects</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523827</guid>
		</item>
		<item>
			<title>MySQL and C#</title>
			<link>http://forums.codeguru.com/showthread.php?t=523826&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 11:58:42 GMT</pubDate>
			<description><![CDATA[I have problem that I cannot reach my data bases trought my c# project. 
Im using latest versions of .Net and MicrosoftVisual C# 2010 Express, XAMPP for apache and MySql, connector from the MySQL folder. The program says Unknown database "name". I have made this database in phpmyadmin panel and c it working just cant reach it. Please help me. There is the cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
namespace bazaffs
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                MySqlConnection conn = new MySqlConnection("Server=127.0.0.1;Port=3306;Database=aaa;Uid=root;Pwd=root;");
                conn.Open();
                MySqlCommand command = conn.CreateCommand();
                command.CommandText = "Select * from bbb ";
                MySqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Console.WriteLine(reader.ToString());
                }
                Console.ReadLine();
                conn.Close();
            }
            catch (Exception ex) 
            {
                Console.Write(ex.Message.ToString());
                Console.ReadLine();
            }
        }
    }
}]]></description>
			<content:encoded><![CDATA[<div>I have problem that I cannot reach my data bases trought my c# project. <br />
Im using latest versions of .Net and MicrosoftVisual C# 2010 Express, XAMPP for apache and MySql, connector from the MySQL folder. The program says Unknown database &quot;name&quot;. I have made this database in phpmyadmin panel and c it working just cant reach it. Please help me. There is the cs :<br />
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using MySql.Data.MySqlClient;<br />
namespace bazaffs<br />
{<br />
    class Program<br />
    {<br />
        static void Main(string[] args)<br />
        {<br />
            try<br />
            {<br />
                MySqlConnection conn = new MySqlConnection(&quot;Server=127.0.0.1;Port=3306;Database=aaa;Uid=root;Pwd=root;&quot;);<br />
                conn.Open();<br />
                MySqlCommand command = conn.CreateCommand();<br />
                command.CommandText = &quot;Select * from bbb &quot;;<br />
                MySqlDataReader reader = command.ExecuteReader();<br />
                while (reader.Read())<br />
                {<br />
                    Console.WriteLine(reader.ToString());<br />
                }<br />
                Console.ReadLine();<br />
                conn.Close();<br />
            }<br />
            catch (Exception ex) <br />
            {<br />
                Console.Write(ex.Message.ToString());<br />
                Console.ReadLine();<br />
            }<br />
        }<br />
    }<br />
}</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=11">C-Sharp Programming</category>
			<dc:creator>K2IpNaGc</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523826</guid>
		</item>
		<item>
			<title>Breaking input string into tokens</title>
			<link>http://forums.codeguru.com/showthread.php?t=523825&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 11:03:03 GMT</pubDate>
			<description><![CDATA[Hi Guys !

I'm get input from the user and then storing it in "s " and then trying make tokens, but it is not working, and after making tokens i'm counting them.

Here is My Code


Code:
---------
#include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main(){

	string s;
	cout<<"Enter Text: " <<endl;
	getline(cin,s);
	
	cout<<"Entered Text is: " << s <<endl;

	istringstream iss(s);
	int count = 0;

	while(iss){
		string sub;
		iss>>sub;
		cout <<"token " << count + 1 << ": " <<sub <<endl;
		count = count +  1;
        }
	
	cout<<"Number of tokens "<<count -1 << endl;

	return 0;
}
---------
Here is my Output

Enter text:
Entered Text is: This is String
token 1: This
token 2: is
token 3: String
token 4:
Number of tokens: 3 

The problem is that i want to store the first two strings "This" and "is" into two variables and how to remove token 4: which is unnecessary&#160;


Thanks in Advance

Warm Regards,

Ewa]]></description>
			<content:encoded><![CDATA[<div>Hi Guys !<br />
<br />
I'm get input from the user and then storing it in &quot;s &quot; and then trying make tokens, but it is not working, and after making tokens i'm counting them.<br />
<br />
Here is My Code<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">#include &lt;iostream&gt;<br />
#include &lt;sstream&gt;<br />
#include &lt;string&gt;<br />
using namespace std;<br />
<br />
int main(){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; string s;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Enter Text: &quot; &lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; getline(cin,s);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Entered Text is: &quot; &lt;&lt; s &lt;&lt;endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; istringstream iss(s);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int count = 0;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(iss){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string sub;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iss&gt;&gt;sub;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt;&quot;token &quot; &lt;&lt; count + 1 &lt;&lt; &quot;: &quot; &lt;&lt;sub &lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count = count +&nbsp; 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Number of tokens &quot;&lt;&lt;count -1 &lt;&lt; endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
}</code><hr />
</div>Here is my Output<br />
<br />
<i>Enter text:<br />
Entered Text is: This is String<br />
token 1: This<br />
token 2: is<br />
token 3: String<br />
token 4:<br />
Number of tokens: 3 </i><br />
<br />
The problem is that i want to store the first two strings &quot;This&quot; and &quot;is&quot; into two variables and how to remove token 4: which is unnecessary&#160;<br />
<br />
<br />
Thanks in Advance<br />
<br />
Warm Regards,<br />
<br />
Ewa</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=9">C++  (Non Visual C++ Issues)</category>
			<dc:creator>me_newbie</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523825</guid>
		</item>
		<item>
			<title>java.io.filepermission access denied error</title>
			<link>http://forums.codeguru.com/showthread.php?t=523824&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 10:30:51 GMT</pubDate>
			<description><![CDATA[the code has a part in which it has to write (append) in a file
i have created that file,the code it saves the entered data in the file.

But when i open it, its not there
this particular exception is thrown


---Quote---
java.security.accesscontrolexception access denied (java.io.filepermission
---End Quote---
i have also changed policy file, but to no avail
i have tried signing the application, but i think it went wrong somewhere

can anyone tell me the "exact" syntax of command that i have to enter in  java.policy file?]]></description>
			<content:encoded><![CDATA[<div>the code has a part in which it has to write (append) in a file<br />
i have created that file,the code it saves the entered data in the file.<br />
<br />
But when i open it, its not there<br />
this particular exception is thrown<br />
<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="alt2">
			<hr />
			
				java.security.accesscontrolexception access denied (java.io.filepermission
			
			<hr />
		</td>
	</tr>
	</table>
</div>i have also changed policy file, but to no avail<br />
i have tried signing the application, but i think it went wrong somewhere<br />
<br />
can anyone tell me the &quot;exact&quot; syntax of command that i have to enter in  java.policy file?</div>


	<br />
	<div style="padding:3px">

	

	
		<fieldset class="fieldset">
			<legend>Attached Images</legend>
			<div style="padding:3px">
			<img class="attach" src="http://forums.codeguru.com/attachment.php?attachmentid=29629&amp;stc=1&amp;d=1337164045" border="0" alt="" />&nbsp;
			</div>
		</fieldset>
	

	

	

	</div>
]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=5">Java Programming</category>
			<dc:creator>isedept</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523824</guid>
		</item>
		<item>
			<title>Problem Redirecting to the Custom Error Page</title>
			<link>http://forums.codeguru.com/showthread.php?t=523822&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 08:47:23 GMT</pubDate>
			<description><![CDATA[Good Day ALL

I have tried something and i am not sure what is the problem. 

i have inherited the an asp.net app. So i want to add the custom Error Handling. I know there are two methods i can do this. 

1) Web Config 

2)Global.asa

So i started with the web config just to see how it will look and i accessed the page that normally gives an Exception. so basically i have a page gives a 

* 
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed. * 

So now , if there is an Error i want it to go to that Error Page. In the web config i have the Following


Code:
---------
<customErrors defaultRedirect="content/ErrorPages/SupportError.aspx" mode="On">
  <error statusCode="404" redirect="content/ErrorPages/SupportError.aspx" />
  <error statusCode="400" redirect="content/ErrorPages/SupportError.aspx" />
  <error statusCode="500" redirect="content/ErrorPages/SupportError.aspx" />
</customErrors>
---------
 

This means that when this kind of Errors occur it should redirect to that page.  All these pages are contents of the Master page including the Error page. But this Error Persist it does not show me the Error page. Even if i try to see if it goes to "Application_Error" in the Global.asa nothing goes there. 

So i have also tried the second option. so i turned the web config part 
"off" and i trapped this in the global.asa like this 



Code:
---------
 Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    Server.Transfer("~/Content/ErrorPages/SupportError.aspx")
 
    'Response.Redirect("~/Content/ErrorPages/SupportError.aspx", False)
End Sub
---------
 

but still nothing happens 

THanks]]></description>
			<content:encoded><![CDATA[<div>Good Day ALL<br />
<br />
I have tried something and i am not sure what is the problem. <br />
<br />
i have inherited the an asp.net app. So i want to add the custom Error Handling. I know there are two methods i can do this. <br />
<br />
1) Web Config <br />
<br />
2)Global.asa<br />
<br />
So i started with the web config just to see how it will look and i accessed the page that normally gives an Exception. so basically i have a page gives a <br />
<br />
<b> <br />
500 - Internal server error.<br />
There is a problem with the resource you are looking for, and it cannot be displayed. </b> <br />
<br />
So now , if there is an Error i want it to go to that Error Page. In the web config i have the Following<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&lt;customErrors defaultRedirect=&quot;content/ErrorPages/SupportError.aspx&quot; mode=&quot;On&quot;&gt;<br />
&nbsp; &lt;error statusCode=&quot;404&quot; redirect=&quot;content/ErrorPages/SupportError.aspx&quot; /&gt;<br />
&nbsp; &lt;error statusCode=&quot;400&quot; redirect=&quot;content/ErrorPages/SupportError.aspx&quot; /&gt;<br />
&nbsp; &lt;error statusCode=&quot;500&quot; redirect=&quot;content/ErrorPages/SupportError.aspx&quot; /&gt;<br />
&lt;/customErrors&gt;</code><hr />
</div>This means that when this kind of Errors occur it should redirect to that page.  All these pages are contents of the Master page including the Error page. But this Error Persist it does not show me the Error page. Even if i try to see if it goes to &quot;Application_Error&quot; in the Global.asa nothing goes there. <br />
<br />
So i have also tried the second option. so i turned the web config part <br />
&quot;off&quot; and i trapped this in the global.asa like this <br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)<br />
&nbsp; &nbsp; Server.Transfer(&quot;~/Content/ErrorPages/SupportError.aspx&quot;)<br />
&nbsp;<br />
&nbsp; &nbsp; 'Response.Redirect(&quot;~/Content/ErrorPages/SupportError.aspx&quot;, False)<br />
End Sub</code><hr />
</div>but still nothing happens <br />
<br />
THanks</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=15">ASP.NET</category>
			<dc:creator>vuyiswam</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523822</guid>
		</item>
		<item>
			<title>Looking for .bmp OR .jpg</title>
			<link>http://forums.codeguru.com/showthread.php?t=523821&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 08:20:11 GMT</pubDate>
			<description><![CDATA[Hi,

We have a box label at work that we print through nicelabel software. It's hooked up to a database so when you print, you enter the barcode number in, and the image is populated by finding the image number associated with the barcode number, looking for it in a folder and adding it in. We were only dealing with .bmp files, so we had some code that would basically get the image number, add .bmp at the end of it and then look for this file in the folder.

Now we've got jpgs too, we've hit a bit of a brick wall in that the execution of the script will fail because the script is looking for, for example '1111.bmp' when it's actually '1111.jpg'.

We need to add something to the script that will possibly do the first part of the code adding .bmp, then if nothing is found in the folder, rather than failing and presenting us with an error message, it just automatically looks for a .jpg version instead.

Is there any way of doing this? I don't know how it would work, something like ignoring the file extension possibly?]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
We have a box label at work that we print through nicelabel software. It's hooked up to a database so when you print, you enter the barcode number in, and the image is populated by finding the image number associated with the barcode number, looking for it in a folder and adding it in. We were only dealing with .bmp files, so we had some code that would basically get the image number, add .bmp at the end of it and then look for this file in the folder.<br />
<br />
Now we've got jpgs too, we've hit a bit of a brick wall in that the execution of the script will fail because the script is looking for, for example '1111.bmp' when it's actually '1111.jpg'.<br />
<br />
We need to add something to the script that will possibly do the first part of the code adding .bmp, then if nothing is found in the folder, rather than failing and presenting us with an error message, it just automatically looks for a .jpg version instead.<br />
<br />
Is there any way of doing this? I don't know how it would work, something like ignoring the file extension possibly?</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=7">Visual C++ Programming</category>
			<dc:creator>TeachYourselfRunning</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523821</guid>
		</item>
		<item>
			<title>AccessViolationException while copying data from C++ to C#</title>
			<link>http://forums.codeguru.com/showthread.php?t=523820&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 08:07:58 GMT</pubDate>
			<description><![CDATA[Hello!

I'm writing a multithreaded program in C#/WPF which is using program code, written in C++. I'm using MS Visual Studio 2010 and I'm building project for x64 platform, .NET 4.0.
I have 2 projects in my solution:
1. C++ project, which is built into DLL with "/clr", and has native C++ code and Visual C++ to call native C++ from C#.
2. C# project, which is drawing windows and control multithreading.

The idea is simple - native C++ program gets initial data, makes some calculations (about several seconds) and output results array with a lot of data. I need to make a lot of these calculations for various initial data. So I made it like this:
•C# parse file with initial data

•C# launches a parallel.for cycle:
--------------------------------------------------------------------------------

Code:
---------
parallelOptions.MaxDegreeOfParallelism = 8; // for 100% load on 8 cores
Parallel.For(0, data.NUM_TRAJECTORIES, parallelOptions, i => { 
// call Visual C++ to call native C++
});
---------
--------------------------------------------------------------------------------

•In unsafe ('cause I need pointers in C# to fill C# array from C++) void function C# creates an array for results:

Code:
---------
data.dataFromCPP[i] = new double[result.GetSize(), 8];        // 8 - is the number of output parameters. result.GetSize() - returns number of rows for current finished calculation
---------
•Using pointer to array, C++ fills C# array with output data:

Code:
---------
fixed (double* p = data.dataFromCPP[i])
{
        result.CopyResults(p);
}
---------
--------------------------------------------------------------------------------
And here's the function from native C++:

Code:
---------
void cSolver::copyResults(double *externalArray)
{
        for(int i = 0 ; i < resultsVector.size(); i++)
        {
                externalArray[i*8 + 0] = resultsVector[i].lat;
                externalArray[i*8 + 1] = resultsVector[i].lon;
                externalArray[i*8 + 2] = resultsVector[i].altitude;
                externalArray[i*8 + 3] = resultsVector[i].tendency;
                externalArray[i*8 + 4] = resultsVector[i].time;
                externalArray[i*8 + 5] = resultsVector[i].Vx;
                externalArray[i*8 + 6] = resultsVector[i].Vy;
                externalArray[i*8 + 7] = resultsVector[i].Vz;
        }
}
---------
The Problem:

The problem is in AccessViolationException while copying data from C++ to C#, last time it occurred on this line


Code:
---------
externalArray[i*8 + 3] = resultsVector[i].tendency;
---------
It appears rarely - I've launched program 4 times, for the first 3 times it done everything excellent, and on the fourth it stopped with this exception. But that's really bad, 'cause for 3200 calculations - it takes about 20 minutes to calculate them all. And when it is stopped on 3197' trajectory - it is reeeealy terrible...

So, can anyone help me with this problem? What am I doing wrong, and what should I do to avoid this exception.

Best regards,
Nikita Petrov.]]></description>
			<content:encoded><![CDATA[<div>Hello!<br />
<br />
I'm writing a multithreaded program in C#/WPF which is using program code, written in C++. I'm using MS Visual Studio 2010 and I'm building project for x64 platform, .NET 4.0.<br />
I have 2 projects in my solution:<br />
1. C++ project, which is built into DLL with &quot;/clr&quot;, and has native C++ code and Visual C++ to call native C++ from C#.<br />
2. C# project, which is drawing windows and control multithreading.<br />
<br />
The idea is simple - native C++ program gets initial data, makes some calculations (about several seconds) and output results array with a lot of data. I need to make a lot of these calculations for various initial data. So I made it like this:<br />
•C# parse file with initial data<br />
<br />
•C# launches a parallel.for cycle:<br />
--------------------------------------------------------------------------------<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">parallelOptions.MaxDegreeOfParallelism = 8; // for 100% load on 8 cores<br />
Parallel.For(0, data.NUM_TRAJECTORIES, parallelOptions, i =&gt; { <br />
// call Visual C++ to call native C++<br />
});</code><hr />
</div>--------------------------------------------------------------------------------<br />
<br />
•In unsafe ('cause I need pointers in C# to fill C# array from C++) void function C# creates an array for results:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">data.dataFromCPP[i] = new double[result.GetSize(), 8];&nbsp; &nbsp; &nbsp; &nbsp; // 8 - is the number of output parameters. result.GetSize() - returns number of rows for current finished calculation</code><hr />
</div>•Using pointer to array, C++ fills C# array with output data:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">fixed (double* p = data.dataFromCPP[i])<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; result.CopyResults(p);<br />
}</code><hr />
</div>--------------------------------------------------------------------------------<br />
And here's the function from native C++:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">void cSolver::copyResults(double *externalArray)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0 ; i &lt; resultsVector.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; externalArray[i*8 + 0] = resultsVector[i].lat;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; externalArray[i*8 + 1] = resultsVector[i].lon;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; externalArray[i*8 + 2] = resultsVector[i].altitude;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; externalArray[i*8 + 3] = resultsVector[i].tendency;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; externalArray[i*8 + 4] = resultsVector[i].time;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; externalArray[i*8 + 5] = resultsVector[i].Vx;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; externalArray[i*8 + 6] = resultsVector[i].Vy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; externalArray[i*8 + 7] = resultsVector[i].Vz;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</code><hr />
</div><font size="3">The Problem:</font><br />
<br />
The problem is in AccessViolationException while copying data from C++ to C#, last time it occurred on this line<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">externalArray[i*8 + 3] = resultsVector[i].tendency;</code><hr />
</div>It appears rarely - I've launched program 4 times, for the first 3 times it done everything excellent, and on the fourth it stopped with this exception. But that's really bad, 'cause for 3200 calculations - it takes about 20 minutes to calculate them all. And when it is stopped on 3197' trajectory - it is reeeealy terrible...<br />
<br />
So, can anyone help me with this problem? What am I doing wrong, and what should I do to avoid this exception.<br />
<br />
Best regards,<br />
Nikita Petrov.</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=17">Managed C++ and C++/CLI</category>
			<dc:creator>nikkitta</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523820</guid>
		</item>
		<item>
			<title>Package-Applet</title>
			<link>http://forums.codeguru.com/showthread.php?t=523819&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 06:44:03 GMT</pubDate>
			<description><![CDATA[hi guys, i am newbie, i have following code

AppletOne.java

[code]
import java.sql.*;
import javax.swing.*;
import Package_DB.*;

public class AppletOne extends JApplet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Connection connection;
	ConnectToDB objConnectToDB = new ConnectToDB();

	public void init() {
		GetData();
	}

	private void GetData() {
		try {
			connection = objConnectToDB.GetConnection("localhost:3306", "test",
					"root", "root@123");
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Throwable e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		String listOfNames = "";
		try {
			listOfNames = GetaDataFromMySQLDataBase();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		JOptionPane.showMessageDialog(null, listOfNames);
	}

	private String GetaDataFromMySQLDataBase() throws SQLException {
		String query = "SELECT * FROM test.test";
		String listOfNames = objConnectToDB.GetDataAsString(connection, query);
		return listOfNames;
	}
}
[code]

and 

a package

[code]
package Package_DB;

import java.sql.*;

public class ConnectToDB {
	private Connection connection;

	public static void main(String args[]) {
		System.out.print("asdasd");
		// JOptionPane.showMessageDialog(null,"listOfNames");
	}

	public Connection GetConnection(String server, String database,
			String userName, String password) throws InstantiationException,
			Exception, Throwable {

		try {
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			connection = DriverManager.getConnection("jdbc:mysql://" + server
					+ "/" + database + "?user=" + userName + "&password="
					+ password);
			return connection;
		} catch (SQLException e) {
			// return e.getMessage();
			return connection;
		}

	}

	public String GetDataAsString(Connection connection, String query)
			throws SQLException {
		Statement statement = connection.createStatement();
		ResultSet rs = statement.executeQuery(query);
		String lastName = "";
		while (rs.next()) {
			lastName += rs.getString("Name") + ",";
		}
		rs.close();
		return lastName;
	}
}

[code]


while running in a eclipse, i got the data from mySQL database.. but in through command prompt i am getting following error

C:\Users\Srihari\workspace\exp1\src>javac AppletOne.java

C:\Users\Srihari\workspace\exp1\src>java AppletOne
Exception in thread "main" java.lang.NoSuchMethodError: main

C:\Users\Srihari\workspace\exp1\src>

and 


C:\Users\Srihari\workspace\exp1\src>appletviewer AppletOne.html
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:211)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:144)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at Package_DB.ConnectToDB.GetConnection(ConnectToDB.java:18)
        at AppletOne.GetData(AppletOne.java:20)
        at AppletOne.init(AppletOne.java:15)
        at sun.applet.AppletPanel.run(AppletPanel.java:424)
        at java.lang.Thread.run(Thread.java:662)
java.lang.NullPointerException
        at Package_DB.ConnectToDB.GetDataAsString(ConnectToDB.java:32)
        at AppletOne.GetaDataFromMySQLDataBase(AppletOne.java:45)
        at AppletOne.GetData(AppletOne.java:35)
        at AppletOne.init(AppletOne.java:15)
        at sun.applet.AppletPanel.run(AppletPanel.java:424)
        at java.lang.Thread.run(Thread.java:662)

C:\Users\Srihari\workspace\exp1\src>


and my html page look like

<html>
	<applet code="AppletOne.class" width="500" height="200"></applet>
	</applet>
</html>

i 've windows7 OS and 've only java path..

but in eclipse i added mysql-connector-java-5.1.6.jar as reference..


please help me in this...]]></description>
			<content:encoded><![CDATA[<div>hi guys, i am newbie, i have following code<br />
<br />
AppletOne.java<br />
<br />
[code]<br />
import java.sql.*;<br />
import javax.swing.*;<br />
import Package_DB.*;<br />
<br />
public class AppletOne extends JApplet {<br />
<br />
	/**<br />
	 * <br />
	 */<br />
	private static final long serialVersionUID = 1L;<br />
	private Connection connection;<br />
	ConnectToDB objConnectToDB = new ConnectToDB();<br />
<br />
	public void init() {<br />
		GetData();<br />
	}<br />
<br />
	private void GetData() {<br />
		try {<br />
			connection = objConnectToDB.GetConnection(&quot;localhost:3306&quot;, &quot;test&quot;,<br />
					&quot;root&quot;, &quot;root@123&quot;);<br />
		} catch (InstantiationException e) {<br />
			// TODO Auto-generated catch block<br />
			e.printStackTrace();<br />
		} catch (Exception e) {<br />
			// TODO Auto-generated catch block<br />
			e.printStackTrace();<br />
		} catch (Throwable e) {<br />
			// TODO Auto-generated catch block<br />
			e.printStackTrace();<br />
		}<br />
<br />
		String listOfNames = &quot;&quot;;<br />
		try {<br />
			listOfNames = GetaDataFromMySQLDataBase();<br />
		} catch (SQLException e) {<br />
			// TODO Auto-generated catch block<br />
			e.printStackTrace();<br />
		}<br />
		JOptionPane.showMessageDialog(null, listOfNames);<br />
	}<br />
<br />
	private String GetaDataFromMySQLDataBase() throws SQLException {<br />
		String query = &quot;SELECT * FROM test.test&quot;;<br />
		String listOfNames = objConnectToDB.GetDataAsString(connection, query);<br />
		return listOfNames;<br />
	}<br />
}<br />
[code]<br />
<br />
and <br />
<br />
a package<br />
<br />
[code]<br />
package Package_DB;<br />
<br />
import java.sql.*;<br />
<br />
public class ConnectToDB {<br />
	private Connection connection;<br />
<br />
	public static void main(String args[]) {<br />
		System.out.print(&quot;asdasd&quot;);<br />
		// JOptionPane.showMessageDialog(null,&quot;listOfNames&quot;);<br />
	}<br />
<br />
	public Connection GetConnection(String server, String database,<br />
			String userName, String password) throws InstantiationException,<br />
			Exception, Throwable {<br />
<br />
		try {<br />
			Class.forName(&quot;com.mysql.jdbc.Driver&quot;).newInstance();<br />
			connection = DriverManager.getConnection(&quot;jdbc:mysql://&quot; + server<br />
					+ &quot;/&quot; + database + &quot;?user=&quot; + userName + &quot;&amp;password=&quot;<br />
					+ password);<br />
			return connection;<br />
		} catch (SQLException e) {<br />
			// return e.getMessage();<br />
			return connection;<br />
		}<br />
<br />
	}<br />
<br />
	public String GetDataAsString(Connection connection, String query)<br />
			throws SQLException {<br />
		Statement statement = connection.createStatement();<br />
		ResultSet rs = statement.executeQuery(query);<br />
		String lastName = &quot;&quot;;<br />
		while (rs.next()) {<br />
			lastName += rs.getString(&quot;Name&quot;) + &quot;,&quot;;<br />
		}<br />
		rs.close();<br />
		return lastName;<br />
	}<br />
}<br />
<br />
[code]<br />
<br />
<br />
while running in a eclipse, i got the data from mySQL database.. but in through command prompt i am getting following error<br />
<br />
C:\Users\Srihari\workspace\exp1\src&gt;javac AppletOne.java<br />
<br />
C:\Users\Srihari\workspace\exp1\src&gt;java AppletOne<br />
Exception in thread &quot;main&quot; java.lang.NoSuchMethodError: main<br />
<br />
C:\Users\Srihari\workspace\exp1\src&gt;<br />
<br />
and <br />
<br />
<br />
C:\Users\Srihari\workspace\exp1\src&gt;appletviewer AppletOne.html<br />
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver<br />
        at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:211)<br />
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)<br />
        at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:144)<br />
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)<br />
        at java.lang.Class.forName0(Native Method)<br />
        at java.lang.Class.forName(Class.java:169)<br />
        at Package_DB.ConnectToDB.GetConnection(ConnectToDB.java:18)<br />
        at AppletOne.GetData(AppletOne.java:20)<br />
        at AppletOne.init(AppletOne.java:15)<br />
        at sun.applet.AppletPanel.run(AppletPanel.java:424)<br />
        at java.lang.Thread.run(Thread.java:662)<br />
java.lang.NullPointerException<br />
        at Package_DB.ConnectToDB.GetDataAsString(ConnectToDB.java:32)<br />
        at AppletOne.GetaDataFromMySQLDataBase(AppletOne.java:45)<br />
        at AppletOne.GetData(AppletOne.java:35)<br />
        at AppletOne.init(AppletOne.java:15)<br />
        at sun.applet.AppletPanel.run(AppletPanel.java:424)<br />
        at java.lang.Thread.run(Thread.java:662)<br />
<br />
C:\Users\Srihari\workspace\exp1\src&gt;<br />
<br />
<br />
and my html page look like<br />
<br />
&lt;html&gt;<br />
	&lt;applet code=&quot;AppletOne.class&quot; width=&quot;500&quot; height=&quot;200&quot;&gt;&lt;/applet&gt;<br />
	&lt;/applet&gt;<br />
&lt;/html&gt;<br />
<br />
i 've windows7 OS and 've only java path..<br />
<br />
but in eclipse i added mysql-connector-java-5.1.6.jar as reference..<br />
<br />
<br />
please help me in this...</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=5">Java Programming</category>
			<dc:creator>miriyalasrihari</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523819</guid>
		</item>
		<item>
			<title>JSP / Javascript</title>
			<link>http://forums.codeguru.com/showthread.php?t=523818&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 06:41:37 GMT</pubDate>
			<description><![CDATA[I want to use a variable's value  which i am getting through resultset from database in jsp scriptlets in my javascipt code .

i want to display that variable in javascript .

or if you can suggest me how can i use javascript inside scriptlets]]></description>
			<content:encoded><![CDATA[<div>I want to use a variable's value  which i am getting through resultset from database in jsp scriptlets in my javascipt code .<br />
<br />
i want to display that variable in javascript .<br />
<br />
or if you can suggest me how can i use javascript inside scriptlets</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=70">Scripting - Server Side (PHP, Perl, etc.)</category>
			<dc:creator>rahuldpandey</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523818</guid>
		</item>
		<item>
			<title>Intercepting/Modifying/Viewing Packets?</title>
			<link>http://forums.codeguru.com/showthread.php?t=523817&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 06:37:43 GMT</pubDate>
			<description><![CDATA[Hello all!

I am new to network programming so forgive my ignorance. :)

I have a question regarding packet intercepting/viewing, etc.

I have a process that runs on my PC. This process communicates to a server using a fixed IP address (I cannot modify it). 

What I want to do is write a program that intercepts the packets going out to the server and allows me to view and or modify the packets. And then the reverse, I want to intercept the returning packets then forward them back to the process.

If I cannot change the IP address / port that the PC process uses how can I "redirect" the packets into my interceptor application? I know there is such a thing as port forwarding that you can setup with your router but I don't think what I am doing is port forwarding. (Or maybe it is?)

Basically here is what I need to do.

[Current]
PROCESS -> SERVER
SERVER->PROCESS

[NEW]
PROCESS->INTERCEPTOR->SERVER
SERVER->INTERCEPTOR->PROCESS

If I could modify the IP address that the process uses I could just change it to connect to my "interceptor." I believe that the fact that I cannot change the IP address is the clutch of the problem here.

Also note that I don't want to just "sniff" the packets. Sniffing would allow me to see the packets but I need to modify them as well.

I hope I was able to describe what I am looking to do well enough for anyone to point me in the right direction. 

Perhaps an image will help explain what I need:

Image: http://i144.photobucket.com/albums/r177/tackyjan/packet-interceptor.png 

Thanks in advance!

Jan]]></description>
			<content:encoded><![CDATA[<div>Hello all!<br />
<br />
I am new to network programming so forgive my ignorance. :)<br />
<br />
I have a question regarding packet intercepting/viewing, etc.<br />
<br />
I have a process that runs on my PC. This process communicates to a server using a fixed IP address (I cannot modify it). <br />
<br />
What I want to do is write a program that intercepts the packets going out to the server and allows me to view and or modify the packets. And then the reverse, I want to intercept the returning packets then forward them back to the process.<br />
<br />
If I cannot change the IP address / port that the PC process uses how can I &quot;redirect&quot; the packets into my interceptor application? I know there is such a thing as port forwarding that you can setup with your router but I don't think what I am doing is port forwarding. (Or maybe it is?)<br />
<br />
Basically here is what I need to do.<br />
<br />
[Current]<br />
PROCESS -&gt; SERVER<br />
SERVER-&gt;PROCESS<br />
<br />
[NEW]<br />
PROCESS-&gt;INTERCEPTOR-&gt;SERVER<br />
SERVER-&gt;INTERCEPTOR-&gt;PROCESS<br />
<br />
If I could modify the IP address that the process uses I could just change it to connect to my &quot;interceptor.&quot; I believe that the fact that I cannot change the IP address is the clutch of the problem here.<br />
<br />
Also note that I don't want to just &quot;sniff&quot; the packets. Sniffing would allow me to see the packets but I need to modify them as well.<br />
<br />
I hope I was able to describe what I am looking to do well enough for anyone to point me in the right direction. <br />
<br />
Perhaps an image will help explain what I need:<br />
<br />
<img src="http://i144.photobucket.com/albums/r177/tackyjan/packet-interceptor.png" border="0" alt="" /><br />
<br />
Thanks in advance!<br />
<br />
Jan</div>

]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?f=62">Network Programming</category>
			<dc:creator>tackyjan</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?t=523817</guid>
		</item>
	</channel>
</rss>

