|
Like memcpy(), is there any method for appending the array i,e memcat()....how could i use it???
|
|
|
|
|
There isn't a memcat() function that corresponds to the strcat() function. If you think about it, a 'memcat ' function doesn't make sense. strcat() does string concatenation. A string is a sequence of bytes, terminated by a zero byte. The mem* functions operate on mem ory, which is a sequence of bytes, but not terminated. Instead, the mem*() functions require that you specify a size for the region of memory you are copying.
Given that explanation, memcpy() will do 'memory concatenation' for you:
memcpy(destination + destination_length,source,source_length);
destination_length += source_length; In this case, you are 'concatenating' a source buffer that is source_length bytes long to the end of a destination buffer that is, prior to the concatenation, destination_length bytes long.
Software Zen: delete this;
|
|
|
|
|
How can i append two different arrays?
|
|
|
|
|
You will need to be more specific. We need to know how the arrays where created to begin with. How about a little code, becuase there is more than one way depending on how your created them.
INTP
Every thing is relative...
|
|
|
|
|
Given different files...the code should count the no of words using threading
Nanjesh b.J.
|
|
|
|
|
|
Given different files...the code should count the no of words using threading
Nanjesh
|
|
|
|
|
I am going to implement Dekker's algorithm to
guarantee mutex exclusion between P1 and P2.The
pseudocode are:
<br />
void p1( )<br />
{<br />
flag = 0;<br />
...<br />
"critical section..."<br />
...<br />
}<br />
<br />
void p2( )<br />
{<br />
flag = 1;<br />
...<br />
"critical section..."<br />
...<br />
} <br />
<br />
<br />
void main()<br />
{<br />
parbegin(p1,p2);<br />
...<br />
}<br />
Do you know how to treat(write) pseudocode "parbegin(p1,p2)". I want to simulate a real race condition, p1 and p2 needs to be concurrent.
Can I just express them as:
void main()
{
p1;
p2;
...
}
|
|
|
|
|
Hi,
I'm wondering if I can use the ANSI String Class in normal classes.
I tried yesterday and got an error.
Product.h
#include
#include
using namespace std;
class Product
{
public:
Product(Product&);
Product(string name, int amount , float price);
float GetPrice();
void SetPrice(float price);
void SetAmount(int Amount);
int GetAmount();
void SetName(string name);
string GetName();
Product();
virtual ~Product();
private:
float itsPrice;
int itsAmount;
string itsName;
};
Product.cpp
Product::Product()
{
}
Product::~Product()
{
}
string Product::GetName()
{
return itsName;
}
void Product::SetName(string name)
{
itsName = name;
}
int Product::GetAmount()
{
return itsAmount;
}
void Product::SetAmount(int Amount)
{
itsAmount = Amount;
}
void Product::SetPrice(float price)
{
itsPrice = price;
}
float Product::GetPrice()
{
return itsPrice;
}
Product::Product(string name, int amount, float price)
{
itsName = name;
itsAmount = amount;
itsPrice = price;
}
Product::Product(Product &rhs)
{
itsName = rhs.GetName();
itsPrice = rhs.GetPrice();
itsAmount = rhs.GetAmount();
}
main.cpp
#include "iostream.h"
#include "Product.h"
using namespace std;
int main()
{
Product p1("Apple",0.25,50);
cout << p1.GetName();
int s;
std::cin >> s;
return 0;
}
The error is : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string,class std::allocator >' (or there is no acceptable conversion)
Please help.
Thanks in advance
Tom
-- modified at 8:04 Saturday 4th March, 2006
|
|
|
|
|
Hey Tom: Please repost your question, but this time place your code inside <pre></pre> tags, and click the "Ignore HTML tags in this message" checkbox. It's tough to read your code otherwise. Good luck.
Software Zen: delete this;
|
|
|
|
|
Does gcc or other compiler work?
|
|
|
|
|
derek7 wrote: can I do win32 app without vc?
Sure, there is a version of gcc for Windows: MingW[^]. Also, I would consider an excellent Digital Mars[^] compiler which is also free.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Hi All,
Wanted to know if theres a way to make the application wait till a blocking call. In My application, before the previous receive() for a message sent is completed, the next message is being sent, any help on how to make the application wait till the response for the previous sent() is received?
Tried having a loop, wherein, the application would send the next message only when IsBlocking() returns a false. But even that doesn't work.
Any help??
|
|
|
|
|
Hi,
I am developing a windows service that uses winsock. However, I am new in service and is wondering on how to implement asynchronous socket in a service.
WSAAsyncSelect uses message pump but service does not have a window class, therefore I tried to create a window but in vain. Anyway, can I really do that?
How do I get the hInstance to create the window? Or please suggest a method to do asynchronous socket in services.
Thanks a lot!
|
|
|
|
|
If you able to deal with the learning curve, there's a more advanced, but much more powerful way to handle async I/O.
It's called I/O Completion Ports. see: http://www.codeproject.com/internet/iocp.asp[^]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Thanks for the reply Peter Weyzen, I will look into I/O Completion Ports.
However, I come across the WSAEventSelect() in Winsock2. How about that? Is it suitable to use in services? FYI, my services is a client that only deals with one connection.
Thanks again.
|
|
|
|
|
1. what does it work?
2. how to know some predefine variable value .for example $(TargetPath) $(IntDir) etc......
|
|
|
|
|
This is a macro that you use inside a custom build step in a Visual Studio 7.0 or 7.1 project. These macros evaluate to useful folder and file paths that are based on your project's location and name. You can't alter these values, since they are determined for you automatically. You can use environment variables in custom build steps, which may be what you want.
Software Zen: delete this;
|
|
|
|
|
where to find info about these? I know $(OutPath) is value that be set in project attribute.
|
|
|
|
|
In the property pages where you can define the custom build steps. The edit field has a button labelled "...". If you click that, it opens a dialog where you can enter more text in a multi-line edit control. There's a button on that dialog labelled "Macros>>" that displays a list of all of the available macros.
Software Zen: delete this;
|
|
|
|
|
|
how do I trap in that function in vc debugger?
dll has no source supply . how to set to trace that function?
|
|
|
|
|
Hi Derek7 !
It's a long process to debug the dll. First you need to have an exe(process), that will call the dll. If you don't have it, build the exe that will call dll functions. I'm goin to put some steps for you to debug the dll.
1. goto Project Settings -> Debug
a. select 'General' for category.
b. put the exe filename(with path) that is using the dll.
2. build the dll and copy it to the path from where the exe file is refering it. (probably register it once agian).
3. run the dll project
that will call the exe inturn. by putting the breakpoints in the functions you can just debug the dll.
4. let me know if you stuck somewhere or it worked for you...
-Malli...!
|
|
|
|
|
thank. it is very clear.But
it seem has no big different from debug exe. why does many people think it is complex to debug dll?
|
|
|
|
|
*
***
*
*
*
**************
|
|
|
|