<?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://www.codeguru.com/forum</link>
		<description>Hard hitting articles, dicussions, resources, and more all focusing for real developers in the real world.</description>
		<language>en</language>
		<lastBuildDate>Sat, 21 Nov 2009 02:42:00 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.codeguru.com/forum/images/misc/rss.jpg</url>
			<title>CodeGuru Forums</title>
			<link>http://www.codeguru.com/forum</link>
		</image>
		<item>
			<title>Link SAPI to Visual c++ 2008</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488562&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 02:26:13 GMT</pubDate>
			<description><![CDATA[Hi guys,
Ive looked everywhere and cant for the life of me find out how to link the speech sdk i have installed to that i can use it in vc++.
I assume that my problem stems from not being linked properly as all my errors are along the lines of:

"error C2065: 'IspVoice' : undeclared identifier"
"error C2065: 'Voice' : undeclared identifier"
"error C2227: left of '->Speak' must point to class/struct/union/generic type"

Im using sdk 5.1 if that helps anyone,

Thanks in advance for any help =)]]></description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
Ive looked everywhere and cant for the life of me find out how to link the speech sdk i have installed to that i can use it in vc++.<br />
I assume that my problem stems from not being linked properly as all my errors are along the lines of:<br />
<br />
&quot;error C2065: 'IspVoice' : undeclared identifier&quot;<br />
&quot;error C2065: 'Voice' : undeclared identifier&quot;<br />
&quot;error C2227: left of '-&gt;Speak' must point to class/struct/union/generic type&quot;<br />
<br />
Im using sdk 5.1 if that helps anyone,<br />
<br />
Thanks in advance for any help =)</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=7">Visual C++ Programming</category>
			<dc:creator>MystX</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488562</guid>
		</item>
		<item>
			<title>multithreading in C++ using boost</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488561&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 01:53:03 GMT</pubDate>
			<description>Hi,

--------------------------------------------------------------------------------------------------------------
1) I would like to understand the concept of multithreading

I have managed to understand some basics of multithreading from the below link, however would like to know a little more. If someone can explain it a bit or provide a URL it would help.

http://www.paulbridger.com/multithreading_concepts/

--------------------------------------------------------------------------------------------------------------
2) How multithreading can be simulated and incorporated by making use of the boost libraries (I am using an Unix environment)

If someone can show with a simple example that would be great as to how multithreading can be simulated that would be great.

Or if you can provide a URL which does that, that would also help.

--------------------------------------------------------------------------------------------------------------


Thanks and Regards,
Muthu</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
--------------------------------------------------------------------------------------------------------------<br />
1) I would like to understand the concept of multithreading<br />
<br />
I have managed to understand some basics of multithreading from the below link, however would like to know a little more. If someone can explain it a bit or provide a URL it would help.<br />
<br />
<a rel="nofollow" href="http://www.paulbridger.com/multithreading_concepts/" target="_blank">http://www.paulbridger.com/multithreading_concepts/</a><br />
<br />
--------------------------------------------------------------------------------------------------------------<br />
2) How multithreading can be simulated and incorporated by making use of the boost libraries (I am using an Unix environment)<br />
<br />
If someone can show with a simple example that would be great as to how multithreading can be simulated that would be great.<br />
<br />
Or if you can provide a URL which does that, that would also help.<br />
<br />
--------------------------------------------------------------------------------------------------------------<br />
<br />
<br />
Thanks and Regards,<br />
Muthu</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=9">C++  (Non Visual C++ Issues)</category>
			<dc:creator>Muthuveerappan</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488561</guid>
		</item>
		<item>
			<title>what string class returns?</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488560&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 23:31:27 GMT</pubDate>
			<description><![CDATA[Hello everybody,



Code:
---------
bool University::setAddress(Address & _a)
{
bool ok = false;
	if (delete [] address ) 
		if(address = new Address[sizeof(_a)])
			if (address->street = _a.street)
				if (address->apartment = _a.apartment)
					if (address->number = _a.number)
						if (address->district = _a.district)
							if (address->city = _a.city)
								if (address->country = _a.country)
									ok = true;
	return ok;
}
---------
i wrote this for my homework as setAddress(Address &) function.


Code:
---------
struct Address{
    string street;
    string apartment;
    string number;
    string district;
    string city;
    string country;

};
---------
this is my struct and i included <string>.  And i get this error.


Code:
---------
c:\documents and settings\beg&#252;m\my documents\visual studio 2008\projects\proje1\proje1\main.cpp(139) : error C2451: conditional expression of type 'std::basic_string<_Elem,_Traits,_Ax>' is illegal
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
---------
how can i fix this or what's my alternative for this function which returns bool?
thanks]]></description>
			<content:encoded><![CDATA[<div>Hello everybody,<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">bool University::setAddress(Address &amp; _a)<br />
{<br />
bool ok = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (delete [] address ) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(address = new Address[sizeof(_a)])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (address-&gt;street = _a.street)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (address-&gt;apartment = _a.apartment)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (address-&gt;number = _a.number)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (address-&gt;district = _a.district)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (address-&gt;city = _a.city)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (address-&gt;country = _a.country)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ok = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return ok;<br />
}</code><hr />
</div>i wrote this for my homework as setAddress(Address &amp;) 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">struct Address{<br />
&nbsp; &nbsp; string street;<br />
&nbsp; &nbsp; string apartment;<br />
&nbsp; &nbsp; string number;<br />
&nbsp; &nbsp; string district;<br />
&nbsp; &nbsp; string city;<br />
&nbsp; &nbsp; string country;<br />
<br />
};</code><hr />
</div>this is my struct and i included &lt;string&gt;.  And i get this error.<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">c:\documents and settings\beg&#252;m\my documents\visual studio 2008\projects\proje1\proje1\main.cpp(139) : error C2451: conditional expression of type 'std::basic_string&lt;_Elem,_Traits,_Ax&gt;' is illegal<br />
&nbsp; &nbsp; &nbsp; &nbsp; with<br />
&nbsp; &nbsp; &nbsp; &nbsp; [<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Elem=char,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Traits=std::char_traits&lt;char&gt;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Ax=std::allocator&lt;char&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called</code><hr />
</div>how can i fix this or what's my alternative for this function which returns bool?<br />
thanks</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=9">C++  (Non Visual C++ Issues)</category>
			<dc:creator>Onbeygir</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488560</guid>
		</item>
		<item>
			<title>Pass Data onclick event</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488559&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 23:13:24 GMT</pubDate>
			<description><![CDATA[Hi,

I have a form with a flow layout panel which I'm loading multiple images into


Code:
---------
...
  Image = new Bitmap(Picture);
  AlbumImage = new PictureBox();
  AlbumImage.Height = 75;
  AlbumImage.Width = 100;
  AlbumImage.SizeMode = PictureBoxSizeMode.StretchImage;
  AlbumImage.Image = Image;

  AlbumImage.Click += new EventHandler<string>(ImageClicked);

   BackPanel.Controls.Add(AlbumImage);
...
---------
  

now when i click an AlbumImage it fires ImageClicked ok but how would I pass an Image ID so i know which image has been clicked 

Thanks]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I have a form with a flow layout panel which I'm loading multiple images into<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 />
&nbsp; Image = new Bitmap(Picture);<br />
&nbsp; AlbumImage = new PictureBox();<br />
&nbsp; AlbumImage.Height = 75;<br />
&nbsp; AlbumImage.Width = 100;<br />
&nbsp; AlbumImage.SizeMode = PictureBoxSizeMode.StretchImage;<br />
&nbsp; AlbumImage.Image = Image;<br />
<br />
&nbsp; AlbumImage.Click += new EventHandler&lt;string&gt;(ImageClicked);<br />
<br />
&nbsp;  BackPanel.Controls.Add(AlbumImage);<br />
...</code><hr />
</div>now when i click an AlbumImage it fires ImageClicked ok but how would I pass an Image ID so i know which image has been clicked <br />
<br />
Thanks</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=11">C-Sharp Programming</category>
			<dc:creator>Theone2k</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488559</guid>
		</item>
		<item>
			<title>socket programming for rookie</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488558&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 22:48:47 GMT</pubDate>
			<description>hi i am rookie

Can u help me some material i can refer to..like ebooks? pls</description>
			<content:encoded><![CDATA[<div>hi i am rookie<br />
<br />
Can u help me some material i can refer to..like ebooks? pls</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=62">Network Programming</category>
			<dc:creator>joyboy</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488558</guid>
		</item>
		<item>
			<title>Conversion Operator</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488557&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 22:15:02 GMT</pubDate>
			<description><![CDATA[Hello everybody : )

I have a question about defining a conversion operator. Everywhere I look, there's an example of operator int() and I can't quite figure it out how it works for more complex classes.

I'm writting an application that uses the SDL library. The library defines a type named SDL_Rect.
SDL_Rect has four public members named : x, y, w, and h. SDL_Rect has only a default constructor and a copy constructor, it has no constructor that takes four parameters. This means that everytime I use an SDL_Rect, I must first define it and then assign values to its four data members. What is more, I can't have a class that has a const SDL_Rect member with values other then the default ones( or can I ? please, correct me if I'm wrong..)

There are a number of functions, defined by SDL, that take an SDL_Rect argument.

1. My first, more general question is:

If I am not sure about how a type is represented, but I do know its interface ( or at least the part of its interface that I intend to use and everything is ok when I'm using only that part) , is it a bad idea to define my own class, similar to that type, but with some extra functionality?
In particular :
When I call some SDL defined function I do something like this( simplified):

Code:
---------
SDL_Rect source;

source.x = 0;
source.y = 0;
source.w = 640;
source.h = 480;

SDL_Rect destination;
// destination.blah blah bla..

SDL_Func( source, destination, //...
---------
I want to be able to do it like this:

Code:
---------
SDL_Func( MyRect(0,0,640,480), MyRect( //....
---------
This way it is obviously easier, more clear, but is it safe, assuming that I am not familiar with any additional members that SDL_Rect might have.

2. My second question is how to do that? : )
I mean, every book that I have gives an example of a class myInt, that defines operator int().. and I can't really get the whole picture..
Here's what I've written so far:


Rect.h :

Code:
---------
#ifndef RECT_H
#define RECT_H

class SDL_Rect;

struct Rect
{
	// No construction with only 1,2 or 3 parameters.
	// I also do not need Rect( const SDL_Rect &),
	// as I don't intend users to pass an SDL_Rect wherever
	// Rect is expected:

	Rect( int xPos, int yPos, int width, int height);
	Rect();                                                                

	operator SDL_Rect() const;

	int x;
	int y;
	int w;
	int h;

};
---------

Rect.cpp :

Code:
---------
#include "Rect.h"
#include "SDL/SDL.h"

//.. constructors..

Rect::operator SDL_Rect() const
{
    // ???
}
---------
How to define it? Do I have to create an SDL_Rect inside and assign its members like this:


Code:
---------
Rect::operator SDL_Rect() const
{
	SDL_Rect temp;

	temp.x = x;
	temp.y = y;
	temp.w = w;
	temp.h = h;

	return temp;
}
---------
Is that correct? 
If it is, isn't it slowing things up?
Can I now use safely Rect, wherever SDL_Rect is exprected??
Should I make you read such long posts the next time I have a question?

I will deeply appreciate any help.]]></description>
			<content:encoded><![CDATA[<div>Hello everybody : )<br />
<br />
I have a question about defining a conversion operator. Everywhere I look, there's an example of operator int() and I can't quite figure it out how it works for more complex classes.<br />
<br />
I'm writting an application that uses the SDL library. The library defines a type named SDL_Rect.<br />
SDL_Rect has four public members named : x, y, w, and h. SDL_Rect has only a default constructor and a copy constructor, it has no constructor that takes four parameters. This means that everytime I use an SDL_Rect, I must first define it and then assign values to its four data members. What is more, I can't have a class that has a const SDL_Rect member with values other then the default ones( or can I ? please, correct me if I'm wrong..)<br />
<br />
There are a number of functions, defined by SDL, that take an SDL_Rect argument.<br />
<br />
1. My first, more general question is:<br />
<br />
If I am not sure about how a type is represented, but I do know its interface ( or at least the part of its interface that I intend to use and everything is ok when I'm using only that part) , is it a bad idea to define my own class, similar to that type, but with some extra functionality?<br />
In particular :<br />
When I call some SDL defined function I do something like this( simplified):<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">SDL_Rect source;<br />
<br />
source.x = 0;<br />
source.y = 0;<br />
source.w = 640;<br />
source.h = 480;<br />
<br />
SDL_Rect destination;<br />
// destination.blah blah bla..<br />
<br />
SDL_Func( source, destination, //...</code><hr />
</div>I want to be able to do it like this:<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">SDL_Func( MyRect(0,0,640,480), MyRect( //....</code><hr />
</div>This way it is obviously easier, more clear, but is it safe, assuming that I am not familiar with any additional members that SDL_Rect might have.<br />
<br />
2. My second question is how to do that? : )<br />
I mean, every book that I have gives an example of a class myInt, that defines operator int().. and I can't really get the whole picture..<br />
Here's what I've written so far:<br />
<br />
<br />
Rect.h :<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">#ifndef RECT_H<br />
#define RECT_H<br />
<br />
class SDL_Rect;<br />
<br />
struct Rect<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; // No construction with only 1,2 or 3 parameters.<br />
&nbsp; &nbsp; &nbsp; &nbsp; // I also do not need Rect( const SDL_Rect &amp;),<br />
&nbsp; &nbsp; &nbsp; &nbsp; // as I don't intend users to pass an SDL_Rect wherever<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Rect is expected:<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Rect( int xPos, int yPos, int width, int height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Rect();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; operator SDL_Rect() const;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int w;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int h;<br />
<br />
};</code><hr />
</div><br />
Rect.cpp :<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 &quot;Rect.h&quot;<br />
#include &quot;SDL/SDL.h&quot;<br />
<br />
//.. constructors..<br />
<br />
Rect::operator SDL_Rect() const<br />
{<br />
&nbsp; &nbsp; // ???<br />
}</code><hr />
</div>How to define it? Do I have to create an SDL_Rect inside and assign its members like this:<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">Rect::operator SDL_Rect() const<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; SDL_Rect temp;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp.x = x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp.y = y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp.w = w;<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp.h = h;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return temp;<br />
}</code><hr />
</div>Is that correct? <br />
If it is, isn't it slowing things up?<br />
Can I now use safely Rect, wherever SDL_Rect is exprected??<br />
Should I make you read such long posts the next time I have a question?<br />
<br />
I will deeply appreciate any help.</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=9">C++  (Non Visual C++ Issues)</category>
			<dc:creator>seventhirty</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488557</guid>
		</item>
		<item>
			<title>Need help setting up audio effect program,have code but cant set up please help!!</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488556&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 20:48:42 GMT</pubDate>
			<description><![CDATA[I am a C++ beginner but know the basics i.e writing simple code compiling and build. I have DevC++ also Visual Studio 2008. 

I'm big in to audio sequencers, and would like to set up a simple delay effect in C++.

Now, I have the code (open source from a website!) but I'm not quite sure how to set up as .exe. I think I need to set up a ".H" folder in my Cdrive so I can open the code below but not sure! I have also heard I may need "TurboC"??

Thank you anyone who can help. See code below...

#ifndef STK_DELAY_H
#define STK_DELAY_H

#include "Filter.h"
 
namespace stk {

/***************************************************/
/***************************************************/

class Delay : public Filter
{
public:

Delay( unsigned long delay = 0, unsigned long maxDelay = 4095 );

~Delay();


void setMaximumDelay( unsigned long delay );
 

void setDelay( unsigned long delay );

unsigned long getDelay( void ) const { return delay_; };
 

StkFloat contentsAt( unsigned long tapDelay );

StkFloat lastOut( void ) const { return lastFrame_[0]; };


StkFloat nextOut( void ) { return inputs_[outPoint_]; };

StkFloat energy( void ) const;

StkFloat tick( StkFloat input );


StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );

 
StkFrames& tick( StkFrames& iFrames, StkFrames &oFrames, unsigned int iChannel = 0, unsigned int oChannel = 0 );

protected:

unsigned long inPoint_;
unsigned long outPoint_;
unsigned long delay_;
};

inline StkFloat Delay :: tick( StkFloat input )
{
inputs_[inPoint_++] = input * gain_;

// Check for end condition
if ( inPoint_ == inputs_.size() )
inPoint_ = 0;

// Read out next value
lastFrame_[0] = inputs_[outPoint_++];

if ( outPoint_ == inputs_.size() )
outPoint_ = 0;

return lastFrame_[0];
}
 
inline StkFrames& Delay :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Delay::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
 
StkFloat *samples = &frames[channel];
unsigned int hop = frames.channels();
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
inputs_[inPoint_++] = *samples * gain_;
if ( inPoint_ == inputs_.size() ) inPoint_ = 0;
*samples = inputs_[outPoint_++];
if ( outPoint_ == inputs_.size() ) outPoint_ = 0;
}

lastFrame_[0] = *(samples-hop);
 return frames;
}

inline StkFrames& Delay :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned int iChannel, unsigned int oChannel )
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "Delay::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
#endif
 
StkFloat *iSamples = &iFrames[iChannel];
StkFloat *oSamples = &oFrames[oChannel];
unsigned int iHop = iFrames.channels(), oHop = oFrames.channels();
inputs_[inPoint_++] = *iSamples * gain_;
if ( inPoint_ == inputs_.size() ) inPoint_ = 0;
*oSamples = inputs_[outPoint_++];
if ( outPoint_ == inputs_.size() ) outPoint_ = 0;
}
lastFrame_[0] = *(oSamples-oHop);
return iFrames;
}
 
} // stk namespace
 
#endif]]></description>
			<content:encoded><![CDATA[<div>I am a C++ beginner but know the basics i.e writing simple code compiling and build. I have DevC++ also Visual Studio 2008. <br />
<br />
I'm big in to audio sequencers, and would like to set up a simple delay effect in C++.<br />
<br />
Now, I have the code (open source from a website!) but I'm not quite sure how to set up as .exe. I think I need to set up a &quot;.H&quot; folder in my Cdrive so I can open the code below but not sure! I have also heard I may need &quot;TurboC&quot;??<br />
<br />
Thank you anyone who can help. See code below...<br />
<br />
#ifndef STK_DELAY_H<br />
#define STK_DELAY_H<br />
<br />
#include &quot;Filter.h&quot;<br />
 <br />
namespace stk {<br />
<br />
/***************************************************/<br />
/***************************************************/<br />
<br />
class Delay : public Filter<br />
{<br />
public:<br />
<br />
Delay( unsigned long delay = 0, unsigned long maxDelay = 4095 );<br />
<br />
~Delay();<br />
<br />
<br />
void setMaximumDelay( unsigned long delay );<br />
 <br />
<br />
void setDelay( unsigned long delay );<br />
<br />
unsigned long getDelay( void ) const { return delay_; };<br />
 <br />
<br />
StkFloat contentsAt( unsigned long tapDelay );<br />
<br />
StkFloat lastOut( void ) const { return lastFrame_[0]; };<br />
<br />
<br />
StkFloat nextOut( void ) { return inputs_[outPoint_]; };<br />
<br />
StkFloat energy( void ) const;<br />
<br />
StkFloat tick( StkFloat input );<br />
<br />
<br />
StkFrames&amp; tick( StkFrames&amp; frames, unsigned int channel = 0 );<br />
<br />
 <br />
StkFrames&amp; tick( StkFrames&amp; iFrames, StkFrames &amp;oFrames, unsigned int iChannel = 0, unsigned int oChannel = 0 );<br />
<br />
protected:<br />
<br />
unsigned long inPoint_;<br />
unsigned long outPoint_;<br />
unsigned long delay_;<br />
};<br />
<br />
inline StkFloat Delay :: tick( StkFloat input )<br />
{<br />
inputs_[inPoint_++] = input * gain_;<br />
<br />
// Check for end condition<br />
if ( inPoint_ == inputs_.size() )<br />
inPoint_ = 0;<br />
<br />
// Read out next value<br />
lastFrame_[0] = inputs_[outPoint_++];<br />
<br />
if ( outPoint_ == inputs_.size() )<br />
outPoint_ = 0;<br />
<br />
return lastFrame_[0];<br />
}<br />
 <br />
inline StkFrames&amp; Delay :: tick( StkFrames&amp; frames, unsigned int channel )<br />
{<br />
#if defined(_STK_DEBUG_)<br />
if ( channel &gt;= frames.channels() ) {<br />
errorString_ &lt;&lt; &quot;Delay::tick(): channel and StkFrames arguments are incompatible!&quot;;<br />
handleError( StkError::FUNCTION_ARGUMENT );<br />
}<br />
#endif<br />
 <br />
StkFloat *samples = &amp;frames[channel];<br />
unsigned int hop = frames.channels();<br />
for ( unsigned int i=0; i&lt;frames.frames(); i++, samples += hop ) {<br />
inputs_[inPoint_++] = *samples * gain_;<br />
if ( inPoint_ == inputs_.size() ) inPoint_ = 0;<br />
*samples = inputs_[outPoint_++];<br />
if ( outPoint_ == inputs_.size() ) outPoint_ = 0;<br />
}<br />
<br />
lastFrame_[0] = *(samples-hop);<br />
 return frames;<br />
}<br />
<br />
inline StkFrames&amp; Delay :: tick( StkFrames&amp; iFrames, StkFrames&amp; oFrames, unsigned int iChannel, unsigned int oChannel )<br />
{<br />
#if defined(_STK_DEBUG_)<br />
if ( iChannel &gt;= iFrames.channels() || oChannel &gt;= oFrames.channels() ) {<br />
errorString_ &lt;&lt; &quot;Delay::tick(): channel and StkFrames arguments are incompatible!&quot;;<br />
handleError( StkError::FUNCTION_ARGUMENT );<br />
#endif<br />
 <br />
StkFloat *iSamples = &amp;iFrames[iChannel];<br />
StkFloat *oSamples = &amp;oFrames[oChannel];<br />
unsigned int iHop = iFrames.channels(), oHop = oFrames.channels();<br />
inputs_[inPoint_++] = *iSamples * gain_;<br />
if ( inPoint_ == inputs_.size() ) inPoint_ = 0;<br />
*oSamples = inputs_[outPoint_++];<br />
if ( outPoint_ == inputs_.size() ) outPoint_ = 0;<br />
}<br />
lastFrame_[0] = *(oSamples-oHop);<br />
return iFrames;<br />
}<br />
 <br />
} // stk namespace<br />
 <br />
#endif</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=7">Visual C++ Programming</category>
			<dc:creator>syntheticmethod</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488556</guid>
		</item>
		<item>
			<title>Help with a USB problem</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488555&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 20:43:25 GMT</pubDate>
			<description><![CDATA[Hopefully this isn't too off topic...

I have a device (a Newport 1918-C meter) that I'd like to control via USB using VB6.  The Newport people do provide VB6 sample code; it's very basic but it does work.  However I find when I shut down the program & then restart it again the program can no longer find the Newport device.  I've found that I need to cycle power to the meter & wait for the PC to notice it again before I'm able to talk with it again with the VB program.

I assume I need to gracefully shut down the VB program & free up the USB port.  I called the meter people, but they were no help... either there is no way or they don't know of one.

This device uses the standard instrument code set (I forget what it's called... the one that uses the *IDN? command) along with some of their own.  I've scanned the manual but see no command that might help.

So does anyone out there know of a way to allow the VB program to gracefully shut down without tying up the UBS port?

If anybody is up for looking into this, here's the example Newport provides:
ftp://download.newport.com/Photonics/Power%20Meters/Current/19xx_29xx-C%20GeneralDrivers/VBSample_Terminal_USB_Only/]]></description>
			<content:encoded><![CDATA[<div>Hopefully this isn't too off topic...<br />
<br />
I have a device (a Newport 1918-C meter) that I'd like to control via USB using VB6.  The Newport people do provide VB6 sample code; it's very basic but it does work.  However I find when I shut down the program &amp; then restart it again the program can no longer find the Newport device.  I've found that I need to cycle power to the meter &amp; wait for the PC to notice it again before I'm able to talk with it again with the VB program.<br />
<br />
I assume I need to gracefully shut down the VB program &amp; free up the USB port.  I called the meter people, but they were no help... either there is no way or they don't know of one.<br />
<br />
This device uses the standard instrument code set (I forget what it's called... the one that uses the *IDN? command) along with some of their own.  I've scanned the manual but see no command that might help.<br />
<br />
So does anyone out there know of a way to allow the VB program to gracefully shut down without tying up the UBS port?<br />
<br />
If anybody is up for looking into this, here's the example Newport provides:<br />
<a rel="nofollow" href="ftp://download.newport.com/Photonics/Power%20Meters/Current/19xx_29xx-C%20GeneralDrivers/VBSample_Terminal_USB_Only/" target="_blank">ftp://download.newport.com/Photonics...inal_USB_Only/</a></div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=4">Visual Basic 6.0 Programming</category>
			<dc:creator>hjehan</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488555</guid>
		</item>
		<item>
			<title>binary input and output stream</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488554&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 20:41:08 GMT</pubDate>
			<description><![CDATA[I'm trying to put together a class or (suite of classes) that'll support reads and writes in binary form into an input and output stream respectively.  The class will also support automatic conversion from big-endian (network byte order) to little-endian and vice-versa.   The question: I need design guidance on how I could setup the class such that I'll have support for both file I/O (read/writes to a file) and/or a vector - of say unsigned char.  For instance. 


Code:
---------
typedef std::vector < unsigned char > uchar_vec ;
int main() {
  unsigned short a ( 0 ); 
  unsigned short b ( 0 ); 
  uchar_vec my_vec ( 4 ) ; 
  contents_from_my_vec_to_shorts >> short_a >> short_b ; 

  contents_from_shorts_to_myvec << short_a << short_b ; 


}
---------
]]></description>
			<content:encoded><![CDATA[<div>I'm trying to put together a class or (suite of classes) that'll support reads and writes in binary form into an input and output stream respectively.  The class will also support automatic conversion from big-endian (network byte order) to little-endian and vice-versa.   The question: I need design guidance on how I could setup the class such that I'll have support for both file I/O (read/writes to a file) and/or a vector - of say unsigned char.  For instance. <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">typedef std::vector &lt; unsigned char &gt; uchar_vec ;<br />
int main() {<br />
&nbsp; unsigned short a ( 0 ); <br />
&nbsp; unsigned short b ( 0 ); <br />
&nbsp; uchar_vec my_vec ( 4 ) ; <br />
&nbsp; contents_from_my_vec_to_shorts &gt;&gt; short_a &gt;&gt; short_b ; <br />
<br />
&nbsp; contents_from_shorts_to_myvec &lt;&lt; short_a &lt;&lt; short_b ; <br />
<br />
<br />
}</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=9">C++  (Non Visual C++ Issues)</category>
			<dc:creator>mop65715</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488554</guid>
		</item>
		<item>
			<title>Custom exception class - variable value becoming lost?</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488553&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 19:57:43 GMT</pubDate>
			<description><![CDATA[Okay, so I'm working on a small application for which I have a custom Exception class, defined as such:


Code:
---------
class InvalidTokenException : public exception {

    string error;

public:
    InvalidTokenException() {};
    ~InvalidTokenException() throw() {};

    InvalidTokenException(string s) {
        this->error = s;
    }

    string getError(){
        return error;
    }

    virtual const char* what() const throw()
    {
        return "Invalid Token Exception";
    }
};
---------

The program reads through a text file, tokenizing input.  If it comes across an invalid token one of these gets generated and thrown.  Because of the recursive nature of tokenizing, an exception frequently has to be thrown, caught, and thrown again.

The weird problem I'm having is this:  depending on where in the program I throw the exception, the string s becomes lost.  I have debug prints in every catch block that catches one of these and prints ex.getError() before throwing it again, and depending on where I throw the error, I see this:


Code:
---------
Opened file : ../../../doc/input.txt for parsing... 

******** Caught invalid token exception in GetNextToken...
 Error was: Invalid Data Token near: 1w

******** Caught invalid token exception in ParseBodyToken: 
 Error was: Invalid Data Token near: 1w

******** Caught invalid token exception in ParseProgToken: 
 Error was: Invalid Data Token near: 1w

******** Caught invalid token exception in GetNextToken...
 Error was: Invalid Data Token near: 1w

Invalid token.  Invalid Parse Data Token near: 1w
Exiting...
---------

However, if I move the invalid token just ONE token further ahead in the input text file...



Code:
---------
Opened file : ../../../doc/input.txt for parsing... 

******** Caught invalid token exception in GetNextToken...
 Error was: 

******** Caught invalid token exception in Parse Data Token...
 Error was: 

******** Caught invalid token exception in GetNextToken...
 Error was: 

******** Caught invalid token exception in ParseBodyToken: 
 Error was: 

******** Caught invalid token exception in ParseProgToken: 
 Error was: 

******** Caught invalid token exception in GetNextToken...
 Error was: 

Invalid token. 
Exiting...
---------

I don't understand where my token is becoming lost for a generic token..  I'm building it with a specific string anywhere that it's generated.

I've tried doing it this way:


Code:
---------
try {
   // statements
}
catch (InvalidTokenException ex) {
   throw ex;
}
---------
And this way:


Code:
---------
try {
   // statements
}
catch (InvalidTokenException ex) {
  throw InvalidTokenException( ex.getError() );  // basically const new one out of old one
}
---------
I can't see any need to use the second method but it was a test after the first method failed.
Does anyone have any suggestions as to why this isn't working?]]></description>
			<content:encoded><![CDATA[<div>Okay, so I'm working on a small application for which I have a custom Exception class, defined as such:<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">class InvalidTokenException : public exception {<br />
<br />
&nbsp; &nbsp; string error;<br />
<br />
public:<br />
&nbsp; &nbsp; InvalidTokenException() {};<br />
&nbsp; &nbsp; ~InvalidTokenException() throw() {};<br />
<br />
&nbsp; &nbsp; InvalidTokenException(string s) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this-&gt;error = s;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; string getError(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; return error;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; virtual const char* what() const throw()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return &quot;Invalid Token Exception&quot;;<br />
&nbsp; &nbsp; }<br />
};</code><hr />
</div><br />
The program reads through a text file, tokenizing input.  If it comes across an invalid token one of these gets generated and thrown.  Because of the recursive nature of tokenizing, an exception frequently has to be thrown, caught, and thrown again.<br />
<br />
The weird problem I'm having is this:  depending on where in the program I throw the exception, the string s becomes lost.  I have debug prints in every catch block that catches one of these and prints ex.getError() before throwing it again, and depending on where I throw the error, I see this:<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">Opened file : ../../../doc/input.txt for parsing... <br />
<br />
******** Caught invalid token exception in GetNextToken...<br />
&nbsp;Error was: Invalid Data Token near: 1w<br />
<br />
******** Caught invalid token exception in ParseBodyToken: <br />
&nbsp;Error was: Invalid Data Token near: 1w<br />
<br />
******** Caught invalid token exception in ParseProgToken: <br />
&nbsp;Error was: Invalid Data Token near: 1w<br />
<br />
******** Caught invalid token exception in GetNextToken...<br />
&nbsp;Error was: Invalid Data Token near: 1w<br />
<br />
Invalid token.&nbsp; Invalid Parse Data Token near: 1w<br />
Exiting...</code><hr />
</div><br />
However, if I move the invalid token just ONE token further ahead in the input text file...<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">Opened file : ../../../doc/input.txt for parsing... <br />
<br />
******** Caught invalid token exception in GetNextToken...<br />
&nbsp;Error was: <br />
<br />
******** Caught invalid token exception in Parse Data Token...<br />
&nbsp;Error was: <br />
<br />
******** Caught invalid token exception in GetNextToken...<br />
&nbsp;Error was: <br />
<br />
******** Caught invalid token exception in ParseBodyToken: <br />
&nbsp;Error was: <br />
<br />
******** Caught invalid token exception in ParseProgToken: <br />
&nbsp;Error was: <br />
<br />
******** Caught invalid token exception in GetNextToken...<br />
&nbsp;Error was: <br />
<br />
Invalid token. <br />
Exiting...</code><hr />
</div><br />
I don't understand where my token is becoming lost for a generic token..  I'm building it with a specific string anywhere that it's generated.<br />
<br />
I've tried doing it this way:<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">try {<br />
&nbsp;  // statements<br />
}<br />
catch (InvalidTokenException ex) {<br />
&nbsp;  throw ex;<br />
}</code><hr />
</div>And this way:<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">try {<br />
&nbsp;  // statements<br />
}<br />
catch (InvalidTokenException ex) {<br />
&nbsp; throw InvalidTokenException( ex.getError() );&nbsp; // basically const new one out of old one<br />
}</code><hr />
</div>I can't see any need to use the second method but it was a test after the first method failed.<br />
Does anyone have any suggestions as to why this isn't working?</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=9">C++  (Non Visual C++ Issues)</category>
			<dc:creator>qwertygeek</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488553</guid>
		</item>
		<item>
			<title>How to choose, Dialog-based app, MDI app, or common window app?</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488552&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 19:06:31 GMT</pubDate>
			<description><![CDATA[I'm designing my app by using of MFC, I'm not quite familiar with MFC framework, my background is some Win32 and WinForms experience. Right here I got some designing issue, and I'm trying to get help from you guys, first here's how my app would look like,
1. Basically, there will be a main window, with some dynamically created sub-windows inside, which may have some nested, also dynamically created, child controls over there, too. Some of controls would be straight CWnd-derived, since I have to draw them by myself in most cases.
2. Sub windows are independent with each other, that is, they conform to standard window behavior, they accept input messages, they have z-orders, they have titlebars (in my test, creating a CWnd with/without WS_CAPTION got different behavior regarding to focus/input message).

At the beginning, I created a CDialog-based app, however, it worked wierd. The focus, the z-order, the painting, all of them got problems. I still can't fix it.

So, I'm rethinking if a CDialog-based app works for my use case. Frankly, I've never seen a dialog-based app contained windows. The reason why I didn't pick up MDI was that I'm totally new to it. I knew little about doc/view, and I did't think concept "doc" was good for my case, I might only need the "view". And people always said MDI got things more complicated.

Secondly, I'm also doubted that building my controls depends on CWnd. I thought it would be simple, when I need to draw then I draw it in OnPaint, when I need to respond specially then I handle messages in WndProc, world should be simple enough. But it doesn't look so simple now. WinForm get its base control type - UserControl, not does MFC.
I found that messages routing didn't work exactly as expected, so I sit back and rethink about if my orginal design is right.

What should be basic structure of my case?

Welcome any suggestion.]]></description>
			<content:encoded><![CDATA[<div>I'm designing my app by using of MFC, I'm not quite familiar with MFC framework, my background is some Win32 and WinForms experience. Right here I got some designing issue, and I'm trying to get help from you guys, first here's how my app would look like,<br />
1. Basically, there will be a main window, with some dynamically created sub-windows inside, which may have some nested, also dynamically created, child controls over there, too. Some of controls would be straight CWnd-derived, since I have to draw them by myself in most cases.<br />
2. Sub windows are independent with each other, that is, they conform to standard window behavior, they accept input messages, they have z-orders, they have titlebars (in my test, creating a CWnd with/without WS_CAPTION got different behavior regarding to focus/input message).<br />
<br />
At the beginning, I created a CDialog-based app, however, it worked wierd. The focus, the z-order, the painting, all of them got problems. I still can't fix it.<br />
<br />
So, I'm rethinking if a CDialog-based app works for my use case. Frankly, I've never seen a dialog-based app contained windows. The reason why I didn't pick up MDI was that I'm totally new to it. I knew little about doc/view, and I did't think concept &quot;doc&quot; was good for my case, I might only need the &quot;view&quot;. And people always said MDI got things more complicated.<br />
<br />
Secondly, I'm also doubted that building my controls depends on CWnd. I thought it would be simple, when I need to draw then I draw it in OnPaint, when I need to respond specially then I handle messages in WndProc, world should be simple enough. But it doesn't look so simple now. WinForm get its base control type - UserControl, not does MFC.<br />
I found that messages routing didn't work exactly as expected, so I sit back and rethink about if my orginal design is right.<br />
<br />
What should be basic structure of my case?<br />
<br />
Welcome any suggestion.</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=7">Visual C++ Programming</category>
			<dc:creator>LifeIsSuffering</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488552</guid>
		</item>
		<item>
			<title>initializing static array</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488551&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 18:45:43 GMT</pubDate>
			<description><![CDATA[I am writing a class which will have a static array. I need to initialize the array using a for loop. There will be several instances of the class, each of which will read values from the array. The instances need to treat the array as "constant". The code to initialize the array needs to be executed only once, not once for each instance.

Can I do all of this, and what is the syntax?]]></description>
			<content:encoded><![CDATA[<div>I am writing a class which will have a static array. I need to initialize the array using a for loop. There will be several instances of the class, each of which will read values from the array. The instances need to treat the array as &quot;constant&quot;. The code to initialize the array needs to be executed only once, not once for each instance.<br />
<br />
Can I do all of this, and what is the syntax?</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=9">C++  (Non Visual C++ Issues)</category>
			<dc:creator>bsaucer</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488551</guid>
		</item>
		<item>
			<title><![CDATA[Fuctions & Arrays]]></title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488550&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 18:20:01 GMT</pubDate>
			<description><![CDATA[Hello,

I have created a simple program that will be adding data into a file, but I need to get this part going first. I'm having a problem when trying to add the name of the item. It skips that line and jumps to the next one not letting me to enter the name. Any help on this will be appreciated.


Code:
---------
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cctype>

#define cMax 100

using namespace std;

void invMenu();
void crtNewItem(double Qty[], double iPrice[], char iName[], int pNumber[]);

int main()
{
    int mSelec;
    bool bDone = false;

	do{

cout << "1. Inventory Management" << endl;
cout << "\nPlease enter your selection [1-5]" << endl;
cin >> mSelec;
while (mSelec < 1  || mSelec > 5)
{
        cout << "Please enter a correct selection between 1-5" << endl;
        cin >> mSelec;
}

switch(mSelec)
{
  case 1: invMenu();
  break;

   }
}while (!bDone);
return 0;

}

void invMenu()

 {
    double Qty[cMax];
    double iPrice[cMax];
    char iName[cMax];
    int pNumber[cMax];

    int iSelec = 0;
	system("cls");
	ofstream outputFile;
    ifstream inputFile;

cout << "\n1. Create New Item" << endl;
cout << "\nPlease enter your selection [1-6]" << endl;
cin >> iSelec;
while (iSelec < 1  || iSelec > 6)
{
        cout << "Please enter a correct selection. [1-6]" << endl;
        cin >> iSelec;
}

switch(iSelec)
{
    case 1:
		//This calls out the fuction to create a new item.
		crtNewItem(Qty,iPrice,iName,pNumber);
    break;
}

 }

void crtNewItem(double Qty[], double iPrice[], char iName[], int pNumber[])

{

				cout << "Please enter the quantity of the item:__";
					cin >> Qty[cMax];
                    
				cout << "Please enter the name of the item:__";
                    cin.getline(iName, cMax);

                cout << "Please enter the part number of the item:__";
                    cin >> pNumber[cMax];

				cout << "Please enter the price of the item:__";
                    cin >> iPrice[cMax];

                    cout << "\n************************************************";
				cout << "\nYou have just added a new item to the inventory!";
                    cout << "\n************************************************" << endl << endl;
}
---------
]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I have created a simple program that will be adding data into a file, but I need to get this part going first. I'm having a problem when trying to add the name of the item. It skips that line and jumps to the next one not letting me to enter the name. Any help on this will be appreciated.<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;iomanip&gt;<br />
#include &lt;fstream&gt;<br />
#include &lt;cctype&gt;<br />
<br />
#define cMax 100<br />
<br />
using namespace std;<br />
<br />
void invMenu();<br />
void crtNewItem(double Qty[], double iPrice[], char iName[], int pNumber[]);<br />
<br />
int main()<br />
{<br />
&nbsp; &nbsp; int mSelec;<br />
&nbsp; &nbsp; bool bDone = false;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; do{<br />
<br />
cout &lt;&lt; &quot;1. Inventory Management&quot; &lt;&lt; endl;<br />
cout &lt;&lt; &quot;\nPlease enter your selection [1-5]&quot; &lt;&lt; endl;<br />
cin &gt;&gt; mSelec;<br />
while (mSelec &lt; 1&nbsp; || mSelec &gt; 5)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter a correct selection between 1-5&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; mSelec;<br />
}<br />
<br />
switch(mSelec)<br />
{<br />
&nbsp; case 1: invMenu();<br />
&nbsp; break;<br />
<br />
&nbsp;  }<br />
}while (!bDone);<br />
return 0;<br />
<br />
}<br />
<br />
void invMenu()<br />
<br />
&nbsp;{<br />
&nbsp; &nbsp; double Qty[cMax];<br />
&nbsp; &nbsp; double iPrice[cMax];<br />
&nbsp; &nbsp; char iName[cMax];<br />
&nbsp; &nbsp; int pNumber[cMax];<br />
<br />
&nbsp; &nbsp; int iSelec = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; system(&quot;cls&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; ofstream outputFile;<br />
&nbsp; &nbsp; ifstream inputFile;<br />
<br />
cout &lt;&lt; &quot;\n1. Create New Item&quot; &lt;&lt; endl;<br />
cout &lt;&lt; &quot;\nPlease enter your selection [1-6]&quot; &lt;&lt; endl;<br />
cin &gt;&gt; iSelec;<br />
while (iSelec &lt; 1&nbsp; || iSelec &gt; 6)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter a correct selection. [1-6]&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; iSelec;<br />
}<br />
<br />
switch(iSelec)<br />
{<br />
&nbsp; &nbsp; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //This calls out the fuction to create a new item.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; crtNewItem(Qty,iPrice,iName,pNumber);<br />
&nbsp; &nbsp; break;<br />
}<br />
<br />
&nbsp;}<br />
<br />
void crtNewItem(double Qty[], double iPrice[], char iName[], int pNumber[])<br />
<br />
{<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the quantity of the item:__&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; Qty[cMax];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the name of the item:__&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin.getline(iName, cMax);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the part number of the item:__&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; pNumber[cMax];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the price of the item:__&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; iPrice[cMax];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\n************************************************&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\nYou have just added a new item to the inventory!&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\n************************************************&quot; &lt;&lt; endl &lt;&lt; endl;<br />
}</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=9">C++  (Non Visual C++ Issues)</category>
			<dc:creator>drkidd22</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488550</guid>
		</item>
		<item>
			<title>Algoritm Problem</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488549&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 18:16:07 GMT</pubDate>
			<description><![CDATA[Hello there,

I have the following situation : I have a moving ball in a rectangular 2D chamber. When the ball touches the walls of the chamber it changes it's direction. It is simple to implement the ball movement when the chamber is empty ( it has only 4 walls). My question is , how to I implement the movement of the ball in a chamber with numerous objects in it ? ( by objects I refer to rectangular or square shapes). Also , I know the initial ball direction. I've tried using a matrix to map the room, but I got stuck in it. Have any good ides of how could this be done ?]]></description>
			<content:encoded><![CDATA[<div>Hello there,<br />
<br />
I have the following situation : I have a moving ball in a rectangular 2D chamber. When the ball touches the walls of the chamber it changes it's direction. It is simple to implement the ball movement when the chamber is empty ( it has only 4 walls). My question is , how to I implement the movement of the ball in a chamber with numerous objects in it ? ( by objects I refer to rectangular or square shapes). Also , I know the initial ball direction. I've tried using a matrix to map the room, but I got stuck in it. Have any good ides of how could this be done ?</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=7">Visual C++ Programming</category>
			<dc:creator>spiriad</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488549</guid>
		</item>
		<item>
			<title>Need help with manipulating windows XP taskbar</title>
			<link>http://www.codeguru.com/forum/showthread.php?t=488548&amp;goto=newpost</link>
			<pubDate>Fri, 20 Nov 2009 17:59:04 GMT</pubDate>
			<description><![CDATA[Here is the situation...

I have a program here at work that spawns multiple windows as child processes. Each spawned window caption contains the type of process that it is, so if the child process is a trade ledger, then the window title will contain the word "ledger" and if the child process is a portfolio, the window title will contain the word "portfolio", etc.

The problem is that the traders could have many, many child processes spawned and because each child process is spawned under the parent executable, Windows XP will group all the windows into 1 single tab on the Windows taskbar.

The traders want to be able to click a button that will rearrange the Windows XP taskbar and group each "Portfolio" window into its own tab and group each "Ledger" window into its own tab, etc. for each kind of child process has been spawned from the parent application.

There's very little documentation on this. I have downloaded programs that can do this, but I can't seem to code it myself. 

Does anyone have a clue on how to do this?

Thanks in adavance.]]></description>
			<content:encoded><![CDATA[<div>Here is the situation...<br />
<br />
I have a program here at work that spawns multiple windows as child processes. Each spawned window caption contains the type of process that it is, so if the child process is a trade ledger, then the window title will contain the word &quot;ledger&quot; and if the child process is a portfolio, the window title will contain the word &quot;portfolio&quot;, etc.<br />
<br />
The problem is that the traders could have many, many child processes spawned and because each child process is spawned under the parent executable, Windows XP will group all the windows into 1 single tab on the Windows taskbar.<br />
<br />
The traders want to be able to click a button that will rearrange the Windows XP taskbar and group each &quot;Portfolio&quot; window into its own tab and group each &quot;Ledger&quot; window into its own tab, etc. for each kind of child process has been spawned from the parent application.<br />
<br />
There's very little documentation on this. I have downloaded programs that can do this, but I can't seem to code it myself. <br />
<br />
Does anyone have a clue on how to do this?<br />
<br />
Thanks in adavance.</div>

]]></content:encoded>
			<category domain="http://www.codeguru.com/forum/forumdisplay.php?f=47">C++ and WinAPI</category>
			<dc:creator>soulaco</dc:creator>
			<guid isPermaLink="true">http://www.codeguru.com/forum/showthread.php?t=488548</guid>
		</item>
	</channel>
</rss>
