|
I am doing debug in Release mode by keeping the break point on the statement and trying to execute one by one.It is simply skipping the statments and cursor is jumping to the next statement.This is how i tested that.
|
|
|
|
|
How did you detect that?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am doing debug in Release mode by keeping the break point on the statement and trying to execute one by one.It is simply skipping the statements and cursor is jumping to the next statement.This is how i tested that.
ex:
Statement 1
int i = 0;
i++;
++i;
Cout << i;
Statement 2;
it will jump to Statement2;
|
|
|
|
|
pallaka wrote: int i = 0;
i++;
++i;
Maybe the compiler optimized the above lines to
int i=2;
What was the program output (i.e. did cout report the expected i value)?
BTW: 'statement jumping' may also heppen if debugger source browsing info is not updated (i.e. try to rebuild you project).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I tried keeping the optimization disabled in Project settings it work fine...
Thanks for all your support
|
|
|
|
|
How exactly do you debug in release mode? It shouldn't be possible to do that with the normal project settings. Do you change your project settings?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I tried keeping the optimization disabled in Project settings it work fine...
Thanks for all your support
|
|
|
|
|
I didn't understand that. When you say 'debug in release mode', do you mean that you run the project in release mode? If so, how can you trace? Release mode has debug symbols disabled.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
While release mode also you can get the debugging information of the code.
In project settings you can set this option.
Debug information
|
|
|
|
|
pallaka wrote: While release mode also you can get the debugging information of the code.
I wish I knew of it before. There have been a couple of times when I had release-only bugs and this would have made my life a lot easier.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
sashoalm wrote: I wish I knew of it before.
You should have asked!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I have to work on TFTP protocol for server.
I already have UDP server program.My question is If I am requesting a file from an TFTP client (Port no changed to 69),any of my UDP's call back functions such as OnConnect(), OnAccept(),Onreceive() function is called or not.
If it is not called what are the changes to be made for my UDP program to accept tftp commands.
Thanks in advance.
Regards,
Sunil Kumar
|
|
|
|
|
sunilkumar.d wrote: any of my UDP's call back functions such as OnConnect(), OnAccept()
OnReceive() should work but OnConnect and OnAccept are not used
with the UDP protocol.
sunilkumar.d wrote: what are the changes to be made for my UDP program to accept tftp commands
As with any protocol, you learn the protocol and implement it
in your code...
THE TFTP PROTOCOL (REVISION 2)[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am trying to write a simple app to upload files via FTP. The first thing to do is call InterntOpen() to establish the connection. The description of the first argument is:
lpszAgent
Pointer to a null-terminated string that specifies the name of the application or entity calling the WinINet functions. This name is used as the user agent in the HTTP protocol.
What is this asking for? Should I use the name of the application I am writing? What is the string used for? In another place the descrption said:
lpszAgent Long pointer to a null-terminated string that contains the name of the application or entity calling the Internet functions (for example, Microsoft Internet Explorer). This name is used as the user agent in the HTTP protocol.
What am I supposed to enter here? Maybe "Microsoft Internet Explorer" That just does not seem right.
I found an example that used "InetURL/1.0" and it seems to compile, but a google search did not help. What is that and why should I use it?
Thanks for your time
|
|
|
|
|
bkelly13 wrote: What is that and why should I use it?
It is simply an identifier for those that desire to use it. It should be optional.
User-Agent[^]
led mike
|
|
|
|
|
Sounds good. I put "nothing" in the string and the call behaved as it did before.
BTW: The InternetOpen(...) appears to return a valid handle.
A call to:
HINTERNET status = InternetConnect(...);
returns a NULL handle. Calling GetLastError() returnes zero, and calling InternetGetLastResponseInfo(...) returns zero with nothing in the string.
It should fail at this point, but is should return a valid error code. Any thoughts on that?
If not, thank you for the first response.
Thanks for your time
|
|
|
|
|
bkelly13 wrote: A call to:
HINTERNET status = InternetConnect(...);
returns a NULL handle.
What does the code look like?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
bkelly13 wrote: A call to:
HINTERNET status = InternetConnect(...);
returns a NULL handle. Calling GetLastError() returnes zero, and calling InternetGetLastResponseInfo(...) returns zero with nothing in the string.
It should fail at this point
Why should it fail?
As mark points out we can't know without the parameters for InternetConnect(). But let's get this out of the way, are you behind a firewall?
led mike
|
|
|
|
|
The code looks like this:
m_InternetConnectHandle = <br />
InternetConnect( m_InternetOpenHandle, <br />
m_IPAddress, <br />
INTERNET_DEFAULT_FTP_PORT,<br />
m_UserName,<br />
m_Password , <br />
INTERNET_SERVICE_FTP, <br />
NULL,
NULL );
<br />
if( m_InternetConnectHandle == NULL )<br />
{ <br />
m_dwErrorValue = GetLastError();<br />
m_ErrorMessage.Format( _T("InternetConnect failed, error %d"), m_dwErrorValue );<br />
AfxMessageBox( m_ErrorMessage, MB_OK );<br />
return;<br />
}
At the time it should have failed because I was trying to access my computer which does not have an FTP site. (Waiting for someone else to get the FTP server ready.) Since then the server was set up and the code works. I still don't know what to do with the last to arguments of the connection function, but is seems to be working.
BTW: The code format looks good in the preview, but not in the posted message. Sorry about that.
Thanks for your time
|
|
|
|
|
When I execute the code below I get:
ERROR_WINHTTP_CANNOT_CONNECT
12029
Returned if connection to the server failed.
link[^]
which is what I would expect since I am behind a firewall which will not allow an FTP connection.
HINTERNET h = InternetOpen( NULL, INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0L);
HINTERNET hC = InternetConnect( h, _T("bogus.com"), INTERNET_DEFAULT_FTP_PORT,
NULL,NULL, INTERNET_SERVICE_FTP, WININET_API_FLAG_SYNC, NULL);
if( !hC)
{
msg.Format(_T("Error Number: %d"), GetLastError());
AfxMessageBox( msg);
}
led mike
|
|
|
|
|
I'm not sure how you got a return value of 0 from GetLastError()
when InternetConnect() failed...I get
12029
ERROR_INTERNET_CANNOT_CONNECT
The attempt to connect to the server failed.
For those missing parameters...
dwFlags: There's only one for FTP (INTERNET_FLAG_PASSIVE).
If you don't know what it does then passing 0 is fine.
dwContext: This value will get passed to any WinINET callbacks
you use for the handle acquired. If you're not doing any asynchronous
stuff, then NULL is fine. Typically (in C++) an object pointer is used
so the static callback function(s) have a pointer to an object which is
the context of the callback call.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm trying to load xml documents via the archive (Getting CFile from that for binary data) that gets passed into my CDocument::Serialize method. However, if there is a content or schema problem, I want to throw an exception so the OnOpenDocument method will catch it, return FALSE, etc...
The constants I have to choose from in CFileException::ThrowErrno leave alot to be desired. There is nothing to describe "invalid file content" or something like that.
What should I do in the serialize method to indicate a file content error? (i.e. XML is not well formed)
|
|
|
|
|
bob16972 wrote: The constants I have to choose from in CFileException::ThrowErrno leave alot to be desired.
Maybe you want to create your own exception?
led mike
|
|
|
|
|
I just noticed CException has those two virtual functions.
I guess I should have caught that earlier. If I derive from CException and customize the virtual functions, I'm guessing I should be good to go.
I slapped myself upside the head (twice) for you.
Thanks for the help.
|
|
|
|
|
can anybody tell me how to implement RIS (Remote installation Services ) through windows APIs ..
vineesh
|
|
|
|