<?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>C Board</title>
		<link>http://cboard.cprogramming.com/</link>
		<description><![CDATA[Cprogramming.com's message board, filled with helpful programmers.]]></description>
		<language>en</language>
		<lastBuildDate>Wed, 16 May 2012 23:01:53 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://cboard.cprogramming.com/images/misc/rss.png</url>
			<title>C Board</title>
			<link>http://cboard.cprogramming.com/</link>
		</image>
		<item>
			<title>Resize console window</title>
			<link>http://cboard.cprogramming.com/c-programming/148599-resize-console-window.html</link>
			<pubDate>Wed, 16 May 2012 22:07:31 GMT</pubDate>
			<description>How to change console resolution to 640x480 when application start in ubuntu using C?Is that possible with ncurses library?</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->How to change console resolution to 640x480 when application start in ubuntu using C?Is that possible with ncurses library?<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/c-programming/">C Programming</category>
			<dc:creator>4c0</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/c-programming/148599-resize-console-window.html</guid>
		</item>
		<item>
			<title>Advice</title>
			<link>http://cboard.cprogramming.com/general-discussions/148597-advice.html</link>
			<pubDate>Wed, 16 May 2012 20:06:13 GMT</pubDate>
			<description><![CDATA[I've been studying C++ for a few months, but still am in the beginning stages. I've decided to pursue my bachelors. There is a nagging question on my mind I must ask. Anyway, the degree is not a BSCS, but a general purpose CIS/business degree. My question... armed with a shiny bachelors degree and...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->I've been studying C++ for a few months, but still am in the beginning stages. I've decided to pursue my bachelors. There is a nagging question on my mind I must ask. Anyway, the degree is not a BSCS, but a general purpose CIS/business degree. My question... armed with a shiny bachelors degree and some in depth self study of C++ over the next 3 years (Im anticipating on <i>atleast</i> reaching a very solid intermediate level based on my learning curve) am I marketable for a decent paying programming job? Whats are some things I can do to enhance my resume? I have zero work experience in the field and cant leave my current job for helpdesk and such. I got a Network+ certification for the heck of it, but its only worth making into a paper airplane. Thanks for your help. If my post is in the wrong area or annoying, please delete it.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/general-discussions/">General Discussions</category>
			<dc:creator>TwoBabyJedis</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/general-discussions/148597-advice.html</guid>
		</item>
		<item>
			<title>Which Gui toolkit should I use.</title>
			<link>http://cboard.cprogramming.com/windows-programming/148596-gui-toolkit-should-i-use.html</link>
			<pubDate>Wed, 16 May 2012 19:29:53 GMT</pubDate>
			<description>What gui tool kit should I use? 
 
For now I my project is windows based. And I will stick to windows for atleast 1 year. I know only C++ and Win32 api. My project is not a simple database application. It is heavily relying on windows memory management , process management and diagnostic function....</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->What gui tool kit should I use?<br />
<br />
For now I my project is windows based. And I will stick to windows for atleast 1 year. I know only C++ and Win32 api. My project is not a simple database application. It is heavily relying on windows memory management , process management and diagnostic function. So I have to use win32.<br />
<br />
So kindly suggest what Gui tool kit should I use with my project so that I have least gui overhead. <br />
<br />
Qt or WxWidgets or MFC or WTL ?<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/windows-programming/">Windows Programming</category>
			<dc:creator>freiza</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/windows-programming/148596-gui-toolkit-should-i-use.html</guid>
		</item>
		<item>
			<title>8086 emulator CPU command verification files (testsuite)?</title>
			<link>http://cboard.cprogramming.com/cplusplus-programming/148595-8086-emulator-cpu-command-verification-files-testsuite.html</link>
			<pubDate>Wed, 16 May 2012 19:13:18 GMT</pubDate>
			<description><![CDATA[Are there any data files (load at either 0x0000:0x7C00 or 0x0000:0x0000) for testing a 8086 CPU emulator for errors? 
I've found one testsuite for the 80186 here (http://forum.osdev.org/viewtopic.php?f=13&t=23739&start=15). 
Is there any for the 8086 too? 
 
Somehow when I try to load DOS 3.1 on my...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Are there any data files (load at either 0x0000:0x7C00 or 0x0000:0x0000) for testing a 8086 CPU emulator for errors?<br />
I've found one testsuite for the 80186 <a href="http://forum.osdev.org/viewtopic.php?f=13&amp;t=23739&amp;start=15" target="_blank">here</a>.<br />
Is there any for the 8086 too?<br />
<br />
Somehow when I try to load DOS 3.1 on my emulator (boot sector loaded at 0x0000:0x7C00), it loops with a labelx: PUSH CX, LOOPNZ labelx. Since CX&gt;(0x1000/2), this would result in a stack overflow (with the stack overwriting the opcodes), since CS=DS=ES=SS.<br />
<br />
Anybody knows how to find the bugs in the 8086 emulated CPU?<br />
Or does anyone has a testsuite for 8086 emulator opcodes?<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/cplusplus-programming/">C++ Programming</category>
			<dc:creator>superfury</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/cplusplus-programming/148595-8086-emulator-cpu-command-verification-files-testsuite.html</guid>
		</item>
		<item>
			<title>keypress simulation needed to complete process automation</title>
			<link>http://cboard.cprogramming.com/linux-programming/148594-keypress-simulation-needed-complete-process-automation.html</link>
			<pubDate>Wed, 16 May 2012 19:06:12 GMT</pubDate>
			<description><![CDATA[Hey y'all. I wrote a daemon script to launch a second script that is responsible for monitoring/controlling a UI program. The problem is that if i run the daemon script on the command line like so: sh /path/to/daemon_script.sh, the monitor script causes the UI to not work correctly. Now if I run...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hey y'all. I wrote a daemon script to launch a second script that is responsible for monitoring/controlling a UI program. The problem is that if i run the daemon script on the command line like so: sh /path/to/daemon_script.sh, the monitor script causes the UI to not work correctly. Now if I run the contents of the daemon script manually on the command line like so: screen watch -n 60 /path/to/monitor_script.sh it works properly and runs every 60 seconds like it is supposed to. So, I am going to make a c program to see if it will work that way. I plan on using execl calls or something similar. Now here is where the problem lies; In order for the process to become daemonized, I need to manually hit control + A and control + D. That is what the screen command is for. Is there a way to simulate these key presses with C? I'll even settle for python, but would prefer C since that is what my entire program is based off of. <br />
<br />
Even a better way to do this would be cool. Suggestions, ideas?<br />
<br />
Thanks!<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/linux-programming/">Linux Programming</category>
			<dc:creator>Annonymous</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/linux-programming/148594-keypress-simulation-needed-complete-process-automation.html</guid>
		</item>
		<item>
			<title>Simple Routing Table Performance</title>
			<link>http://cboard.cprogramming.com/tech-board/148593-simple-routing-table-performance.html</link>
			<pubDate>Wed, 16 May 2012 18:45:19 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I'm looking at creating a routing system for use with an inter-thread communication (asynchronous method calling) framework that I am working on. 
 
I have a function that is analogous to Windows's PostMessage.  It dispatches method calls to the incoming queue of the appropriate instance....]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hello,<br />
<br />
I'm looking at creating a routing system for use with an inter-thread communication (asynchronous method calling) framework that I am working on.<br />
<br />
I have a function that is analogous to Windows's PostMessage.  It dispatches method calls to the incoming queue of the appropriate instance.  That instance may be a single thread doing the work of a specific instance, or it may be a thread that handles multiple instances.  In the latter case, I need a way to quickly find which thread is responsible for a given instance.<br />
<br />
The best thing that I can come up with at the moment is a per-thread structure that stores the thread ID for a given instance ID.  But what is the fastest way to perform a search (this function would be called several times on average per method call, per thread)?<br />
<br />
A binary tree initially came to mind, but I'm not sure.  This is a fairly simple framework (number of instances will never exceed 255, instance IDs are generated sequentially until they wrap around), so the work required to maintain a balanced tree for each thread may not be worth it.  Would it be better to simply have an array of 255 entries and index directly into it (would cost a couple KB in memory per thread)?<br />
<br />
I don't think actual network routers use trees, do they?<br />
<br />
What about some sort of structure where each successful search for an instance ID promotes that ID, making it faster to find it the next time?<br />
<br />
Sorry about the questions, but this is probably the most performance critical aspect of what I'm doing. :o<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/tech-board/">Tech Board</category>
			<dc:creator>SMurf</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/tech-board/148593-simple-routing-table-performance.html</guid>
		</item>
		<item>
			<title>Basic pointers to structures question...</title>
			<link>http://cboard.cprogramming.com/c-programming/148592-basic-pointers-structures-question.html</link>
			<pubDate>Wed, 16 May 2012 17:31:00 GMT</pubDate>
			<description>header: 
 
Code: 
--------- 
struct termlist 
{ 
      uint32_t num_terms;  
      char **term;            
};</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->header:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">struct termlist<br />
{<br />
&nbsp; &nbsp; &nbsp; uint32_t num_terms; <br />
&nbsp; &nbsp; &nbsp; char **term;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
};<br />
<br />
int getMetaData( uint32_t specific_tag, termlist **terms);</code><hr />
</div>main:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">int main(int argc, char **argv)<br />
{<br />
<br />
uint32_t specificTag;<br />
specificTag = atoi(argv[1]);<br />
<br />
termlist *sample1;<br />
<br />
getMetaData( specificTag, sample1 );<br />
<br />
...<br />
<br />
}</code><hr />
</div><br />
Hi, I'm really confused about pointers to structures. I'm trying to understand this snippet of code above. <br />
<br />
The function prototype requires a double pointer to the structure, termlist **terms. But in main when calling the function only a pointer to the structure is passed, sample1. <br />
<br />
I'm quite confused on how the function prototype requires a double pointer, but in main only a single pointer is passed.<br />
<br />
<br />
Thanks!<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/c-programming/">C Programming</category>
			<dc:creator>superbbrr</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/c-programming/148592-basic-pointers-structures-question.html</guid>
		</item>
		<item>
			<title><![CDATA[redefinition of 'main' error]]></title>
			<link>http://cboard.cprogramming.com/c-programming/148591-redefinition-main-error.html</link>
			<pubDate>Wed, 16 May 2012 16:49:08 GMT</pubDate>
			<description><![CDATA[Hi 
 
I have tow files with each one int main() function, the second file has an header file, when i compile i have this error 
 
redefinition of 'main' error 
 
I can't use main in both source files?? 
 
 
Regards]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hi<br />
<br />
I have tow files with each one int main() function, the second file has an header file, when i compile i have this error<br />
<br />
redefinition of 'main' error<br />
<br />
I can't use main in both source files??<br />
<br />
<br />
Regards<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/c-programming/">C Programming</category>
			<dc:creator>Gil Carvalho</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/c-programming/148591-redefinition-main-error.html</guid>
		</item>
		<item>
			<title>Float that initializes to NaN</title>
			<link>http://cboard.cprogramming.com/cplusplus-programming/148590-float-initializes-nan.html</link>
			<pubDate>Wed, 16 May 2012 15:22:29 GMT</pubDate>
			<description>Hi! I want to make a class that works exactly like a float, only that it is initialized to NaN when the default constructor is called and if DEBUG is defined so that I can easily detect when I have an uninitialized float. Is there some simple way to do this? Thanks in advance!</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hi! I want to make a class that works exactly like a float, only that it is initialized to NaN when the default constructor is called and if DEBUG is defined so that I can easily detect when I have an uninitialized float. Is there some simple way to do this? Thanks in advance!<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/cplusplus-programming/">C++ Programming</category>
			<dc:creator>then</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/cplusplus-programming/148590-float-initializes-nan.html</guid>
		</item>
		<item>
			<title>Sending Data to Excel with C++</title>
			<link>http://cboard.cprogramming.com/cplusplus-programming/148589-sending-data-excel-cplusplus.html</link>
			<pubDate>Wed, 16 May 2012 14:38:38 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:]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hi folks,<br />
<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 />
<br />
Text file sample:<br />
<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">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><br />
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 />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; string&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; line;<br />
&nbsp; &nbsp; string&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *col1, *col2, *col4, *col5, *col21;&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; col1 = new string[fileLength];<br />
&nbsp; &nbsp; col2 = new string[fileLength];<br />
&nbsp; &nbsp; col3 = new LONG[fileLength];<br />
&nbsp; &nbsp; col4 = new string[fileLength];<br />
&nbsp; &nbsp; col5 = new string[fileLength];<br />
&nbsp; &nbsp; col6 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col7 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col8 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col9 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col10 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col11 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col12 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col13 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col14 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col15 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col16 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col17 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col18 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col19 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col20 = new FLOAT[fileLength];<br />
&nbsp; &nbsp; col21 = new string[fileLength];<br />
<br />
<br />
while(getline(file, line))<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; std::stringstream&nbsp; &nbsp; linestream(line);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Reading space separated columns into string arrays<br />
&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; 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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; }</code><hr />
</div><br />
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 href="http://support.microsoft.com/kb/216686" target="_blank">How to automate Excel from C++ without using MFC or #import</a><br />
<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 />
<br />
I would think there's probably a better way to do this conversion but haven't come up with one.<br />
<br />
<br />
Anyway, my conversion form single byte to wide string is achieved using the following function:<br />
<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">wstring stws(const string &amp;src_string)<br />
{<br />
&nbsp; &nbsp; size_t src_len = src_string.length();<br />
<br />
<br />
&nbsp; &nbsp; if(0 == src_len)<br />
&nbsp; &nbsp; &nbsp; &nbsp; return L&quot;&quot;;<br />
<br />
<br />
&nbsp; &nbsp; wchar_t *buf = new(std::nothrow) wchar_t[src_len + 1];<br />
<br />
<br />
&nbsp; &nbsp; if(0 == buf)<br />
&nbsp; &nbsp; &nbsp; &nbsp; return L&quot;&quot;;<br />
<br />
<br />
&nbsp; &nbsp; mbstowcs(buf, src_string.c_str(), src_len);<br />
&nbsp; &nbsp; buf[src_len] = L'\0';<br />
<br />
<br />
&nbsp; &nbsp; wstring final_string = buf;<br />
<br />
<br />
&nbsp; &nbsp; if(0 != buf)<br />
&nbsp; &nbsp; &nbsp; &nbsp; delete [] buf;<br />
<br />
<br />
&nbsp; &nbsp; return final_string;<br />
}</code><hr />
</div><br />
The further conversion from wide string to BSTR is carried out like so:<br />
<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; <br />
&nbsp; &nbsp; wcol1 = new wstring[fileLength];<br />
&nbsp; &nbsp; wcol2 = new wstring[fileLength];<br />
&nbsp; &nbsp; wcol4 = new wstring[fileLength];<br />
&nbsp; &nbsp; wcol5 = new wstring[fileLength];<br />
&nbsp; &nbsp; wcol21 = new wstring[fileLength];<br />
<br />
<br />
&nbsp; &nbsp; bcol1 = new BSTR[fileLength];<br />
&nbsp; &nbsp; bcol2 = new BSTR[fileLength];<br />
&nbsp; &nbsp; bcol4 = new BSTR[fileLength];<br />
&nbsp; &nbsp; bcol5 = new BSTR[fileLength];<br />
&nbsp; &nbsp; bcol21 = new BSTR[fileLength];<br />
<br />
<br />
for(int i=0; i&lt;10; i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol1[i] = stws(col1[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol2[i] = stws(col2[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol4[i] = stws(col4[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol5[i] = stws(col5[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; wcol21[i] = stws(col21[i]);<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol1[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol2[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol4[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol5[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; bcol21[i] = SysAllocString(wcol1[i].c_str());<br />
&nbsp; &nbsp; }</code><hr />
</div><br />
I've printed the BSTR values to the console using wcout to confirm that they are correct. <br />
<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 />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; <br />
// Create a safearray of variants...<br />
&nbsp; &nbsp; VARIANT arr;<br />
&nbsp; &nbsp; arr.vt = VT_ARRAY | VT_VARIANT;<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; SAFEARRAYBOUND sab[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; sab[0].lLbound = 1; sab[0].cElements = 10;<br />
&nbsp; &nbsp; &nbsp; &nbsp; sab[1].lLbound = 1; sab[1].cElements = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; arr.parray = SafeArrayCreate(VT_VARIANT, 2, sab);<br />
&nbsp; &nbsp; }<br />
<br />
<br />
// Fill safearray with some values...<br />
&nbsp; &nbsp; for(int i=0; i&lt;10; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int j=0; j&lt;2; j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create entry value for (i,j)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VARIANT tmp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmp.vt = VT_BSTR;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmp.bstrVal = bcol2[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Add to safearray...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long indices[] = {i,j};<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SafeArrayPutElement(arr.parray, indices, (void *)&amp;tmp);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</code><hr />
</div><br />
<br />
<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 />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; <br />
// Set range with our safearray...<br />
&nbsp; &nbsp; AutoWrap(DISPATCH_PROPERTYPUT, NULL, pXlRange, L&quot;Value&quot;, 1, arr);</code><hr />
</div><br />
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 />
<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 />
<br />
Any help would be greatly appreciated, ty.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/cplusplus-programming/">C++ Programming</category>
			<dc:creator>chopshardiman</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/cplusplus-programming/148589-sending-data-excel-cplusplus.html</guid>
		</item>
		<item>
			<title>Debugging help, pointer forwarding</title>
			<link>http://cboard.cprogramming.com/c-programming/148588-debugging-help-pointer-forwarding.html</link>
			<pubDate>Wed, 16 May 2012 14:31:55 GMT</pubDate>
			<description><![CDATA[There's the code under, but I'm getting an invalid read size of 4,  and it seems because I forwarded the pointer a little far ahead... I think. 
It's just a little part of my network code, but it's pretty easy to understand what I'm doing under right?   
 
LSP_buffer is a  char *, that's why I have...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->There's the code under, but I'm getting an invalid read size of 4,  and it seems because I forwarded the pointer a little far ahead... I think.<br />
It's just a little part of my network code, but it's pretty easy to understand what I'm doing under right?  <br />
<br />
LSP_buffer is a  char *, that's why I have to cast it.<br />
<br />
 allocated memory for a struct LSP and how many counts edges there is around this router(nodes). <br />
<br />
Not so sure if I thought it out right, by adding sizeof(struct LSP) to pointer it would mean forwarding the pointer by so many bytes as the size of struct right?, why then would I get &quot;Invalid write of size 4&quot; ?<br />
<br />
thanks for replying.<br />
<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><br />
&nbsp;  LSP_buffer = malloc((sizeof(struct LSP) + (sizeof(struct EDGE) * count))); <br />
&nbsp; &nbsp; lsp = (struct LSP*) LSP_buffer;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*cast it to struct LSP and write in the necessary info about this LSP*/<br />
&nbsp; &nbsp; lsp-&gt;source = htonl(own);<br />
&nbsp; &nbsp; lsp-&gt;seq = htonl(LSP_generation++);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*set which generation this LSP is, and increment it*/<br />
&nbsp; &nbsp; lsp-&gt;nodes = htonl(count);<br />
&nbsp; &nbsp; node = (struct NODE *) (LSP_buffer + sizeof(struct LSP));&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*cast LSP_buffer to struct EDGE and move the pointer forward so we don't overwrite any data*/<br />
&nbsp;  <br />
&nbsp; &nbsp; fprintf(stderr, &quot;Own address: %d LSP generation is %d\n&quot;, own , LSP_generation);<br />
&nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; /*store info about the edges around this router*/<br />
&nbsp; &nbsp; for(i = 0; i &lt; MAX_ADDRESSES; i++){&nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; if(distance[own][i].cost &gt; 0){<br />
&nbsp; &nbsp; node-&gt;address = htonl(i);&nbsp;  &lt;---------------------------&nbsp; &nbsp; <br />
&nbsp; &nbsp; node-&gt;cost = htonl(distance[own][i].cost);<br />
&nbsp; &nbsp; node = node + sizeof(struct NODE);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*forward pointer by sizeof struct NODE so we don't overwrite old NODE data*/<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</code><hr />
</div><!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/c-programming/">C Programming</category>
			<dc:creator>Hoang Bao Ngo</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/c-programming/148588-debugging-help-pointer-forwarding.html</guid>
		</item>
		<item>
			<title>how to create a 3 x 3 matrix</title>
			<link>http://cboard.cprogramming.com/c-programming/148587-how-create-3-x-3-matrix.html</link>
			<pubDate>Wed, 16 May 2012 12:10:03 GMT</pubDate>
			<description>how do i create a 3 x 3 matrix and find the sum of elements in all rows?</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->how do i create a 3 x 3 matrix and find the sum of elements in all rows?<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/c-programming/">C Programming</category>
			<dc:creator>kavitabix</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/c-programming/148587-how-create-3-x-3-matrix.html</guid>
		</item>
		<item>
			<title>how to count number of strings being used in an array of strings</title>
			<link>http://cboard.cprogramming.com/c-programming/148586-how-count-number-strings-being-used-array-strings.html</link>
			<pubDate>Wed, 16 May 2012 11:44:56 GMT</pubDate>
			<description><![CDATA[hi everyone, my title seems confusing but i didnt know how to word it any other way so ill explain it a bit better here. 
 
i have declared an array of strings to be,dir[30][13]. Now my program is supposed load file names into those strings and i want to know how i can count the number of strings...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->hi everyone, my title seems confusing but i didnt know how to word it any other way so ill explain it a bit better here.<br />
<br />
i have declared an array of strings to be,dir[30][13]. Now my program is supposed load file names into those strings and i want to know how i can count the number of strings being used in that array of strings. <br />
<br />
ive tried doing while(dir[i]!=NULL) and various other combinations of functions but i cant think of how to solve this problem. <br />
<br />
In my program if i want to add a new file to the dir with user input and the dir is full (all string arrays are being used) then an error message of &quot;directory is full&quot; will show up. <br />
<br />
your help is appreciated<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/c-programming/">C Programming</category>
			<dc:creator>kiwisfan</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/c-programming/148586-how-count-number-strings-being-used-array-strings.html</guid>
		</item>
		<item>
			<title>Hi!</title>
			<link>http://cboard.cprogramming.com/general-discussions/148585-hi.html</link>
			<pubDate>Wed, 16 May 2012 10:46:17 GMT</pubDate>
			<description>Whats up? Frist time learning C should be interesting. starting a years course in development, should include alot of C, C++, java and suchlikes. 
 
Anyways, this is what I came up with on the first day of C. :D 
 
cya aroundAttachment 11665...</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Whats up? Frist time learning C should be interesting. starting a years course in development, should include alot of C, C++, java and suchlikes.<br />
<br />
Anyways, this is what I came up with on the first day of C. :D<br />
<br />
cya around<img src="http://cboard.cprogramming.com/attachments/general-discussions/11665d1337165167-hi-float.jpg" border="0" alt="Name:  Float.jpg
Views: 28
Size:  97.4 KB"  /><!-- google_ad_section_end --></div>


	<div style="padding:10px">

	

	
		<fieldset class="fieldset">
			<legend>Attached Images</legend>
				<div style="padding:10px">
				<img class="attach" src="http://cboard.cprogramming.com/attachments/general-discussions/11665d1337165167-hi-float.jpg" alt="" />&nbsp;
			</div>
		</fieldset>
	

	

	

	</div>
]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/general-discussions/">General Discussions</category>
			<dc:creator>Nogmor</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/general-discussions/148585-hi.html</guid>
		</item>
		<item>
			<title>Books on Data Structures</title>
			<link>http://cboard.cprogramming.com/c-programming/148584-books-data-structures.html</link>
			<pubDate>Wed, 16 May 2012 10:16:36 GMT</pubDate>
			<description>hello guys,  
Can anyone please recommend me some good books on Data Structures Using C Language.  
Thank you. 
Please help me ASAP. :)</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->hello guys, <br />
Can anyone please recommend me some good books on Data Structures Using C Language. <br />
Thank you.<br />
Please help me ASAP. :)<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/c-programming/">C Programming</category>
			<dc:creator>smoker91</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/c-programming/148584-books-data-structures.html</guid>
		</item>
	</channel>
</rss>

