|
of course you can, but only in C++
But what is troubling in your code lines, is that you overload an "=" operator, but it doesn't return anything, so, if the parameter is the value you want to assign to another, where is the destination ??
Are these operator inside classes definitions?
is this better ?
<font style="color:blue;">void operator</font> = (<font style="color:blue;">void</font>* DestObject, <font style="color:blue;">char</font>* arg_cDate); <font style="color:green;">
<font style="color:blue;">CDate& CDate::operator</font> = (CDate arg_cdDate); <font style="color:green;">
for the last one, i would even prefered that synopsis :
<font style="color:blue;">CDate& CDate::operator</font> = (<font style="color:blue;">const</font> CDate& refDate); <font style="color:green;">
what do you think about this ?
TOXCCT >>> GEII power
|
|
|
|
|
You're right, I am so n000b (thanks!! )
|
|
|
|
|
what am i doing wrong?
i open a file in a function and i can't see it in main. thanks for your help!
<br />
int main (void)<br />
{<br />
FILE *archc=NULL;<br />
<br />
load (archc);<br />
<br />
<br />
fprintf (archc,"hello");
fclose(archc);
<br />
return 0;<br />
}<br />
<br />
void load (FILE *archc)<br />
{<br />
archc = fopen("simple.c","r+")<br />
}<br />
|
|
|
|
|
Try this
int main (void)
{
FILE *archc=NULL;
load (archc);
fprintf (archc,"hello"); //can't write
fclose(archc); //can't close as well
return 0;
}
void load (FILE *&archc)
{
archc = fopen("simple.c","r+")
}
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
|
You must pass the address of the FILE pointer variable.
instead of that you passed the pointer variable value.
More n' More
|
|
|
|
|
don't forget to type if the fopen() really opened your file by testing its return value.
TOXCCT >>> GEII power
|
|
|
|
|
One possibility,
int main (void)
{
FILE *archc=load ();
if ( archc )
{
...
}
return 0;
}
FILE * load ()
{
return fopen("simple.c","r+") ;
}
But if you don't have to use C consider looking at IOStreams in the C++ Standard Library.
Paul
|
|
|
|
|
Both recv() and WSARecv() block if the data is not available. What can I do to make them non-blocking? I just want to get the data from the server if it is available, otherwise, go on to something else.
I've never used sockets before so the answer is probably obvious.
Thanks,
DC
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
wow david i am suprised... first question ever from you.
Any ways i had a similar problem... so i wrote my own read function that would spawn a thread... in the thread i would recv...
and in myread function i would wait till timeout..
if the thread timedout i assume that the recv has blocked otherwize i have the data.
I dont konw how efficient it is or wheather there exits a better alternative, but its working as of now.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
What I/O model does the process utilize?
Kuphryn
|
|
|
|
|
have a look a the select() function to make any blocking function at a normal time get non-blocking...
in fact, that is a function i use under linux, but it must have an equivalent for Windows programmers if it is not the same.
TOXCCT >>> GEII power
|
|
|
|
|
select() and ioctlsocket() are what I needed. Thanks.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Either select() or I/O completion ports.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
You can also use ioctlsocket with the FIONBIO option to change your blocking socket into a non-blocking socket. If an operation would normally block, the call instead returns WSAEWOULDBLOCK .
The Winsock Programmer's FAQ[^] is a useful resource.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Yes, that is what I ended up using. Thanks.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I wish to use MSXML2 in my application so I can look at some RSS feeds. I am using Visual C++ 6.0.
I have seen some example code but it mostly is C# but there is some code in one article on CP that has its code written in C++.
One line of code is like this:
::IXMLDOMNode *pNode = NULL;
When I add this code, I get a compile error. Must I download the latest SDK or something else?
Any help is much appreciated
|
|
|
|
|
You need to import the MSXML type library in your stdafx.h.
e.g.
#import <msxml14.dll> named_guids
That will at least get it to compile
Try here[^] and here[^] as a good source of information on learning XML technologies.
"Oh, I'm sick of doing Japanese stuff! In jail we had to be in this dumb kabuki play about the 47 Ronin, and I wanted to be Oshi, but they made me Ori!"
|
|
|
|
|
Don't. Use expat, there is an article here on CodeProject that details exactly how to use it.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
I'm writing a screen saver which will, from time to time, swap out and display different images. Currently it just repaints the new image - no problem. What I'd like to do is add some simple transition effects like fading from one image to another. I done some looking around to find out how to do this but have had no luck. I guess I can't get the right search keywords. Anyway, can someone point me in a direction of sample code or a free-but-good library (I prefer sample code)?
Thanks,
Randy
Randy
|
|
|
|
|
Sorry...more info....
Visual C++ and MFC
Randy
|
|
|
|
|
Search for CxImage here in codeproject may be that would help you someway.;)
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
Hello All,
I am trying to run a basic genetic algorithm program.I am able to compile the program for a GA 1D Array but when i execute i am getting the following erros.
error LNK2001: unresolved external symbol _WinMain@16
Debug/GA1DArra.exe : fatal error LNK1120: 1 unresolved externals.
I am a novice at programming and am basically stuck and am not able to proceed further. Please help me out if you could.
Thanks in advance.
Ramya
Ramya
|
|
|
|
|
Ramya, it seems you are trying to write a console application with windows-based programs' project settings.
ie,try Project -> Settings -> Link
and on the bottom box search for "/Subsystem:windows" and change it to
"/subsystem:console".
Im not sure tats the only one to be changed...
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
What kind of project have you selected?
or lookup for LNK2001 in the msdn. it would offer you some help and some additional knowledge to tackle this kind of problem.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|