|
I don't actually know what you're trying to do with this, but a pretty common mistake is miscounting the number of elements you're trying to allocate, so while you might think you've allocated accurately, you could be one off, which causes lots of problems.
For example:
"Phil Collins"
Has a total of 13 elements, even though there's actually 12 characters in "Phil Collins". A common mistake is to forget the '\0' character at the end of every C-style string, so the whole thing is thrown off. (BTW, I used "Phil Collins" because I named a tree after him in a video game I'm working on... Does Phil Collins work as a good name for a tree..? )
I hope that helps; bits of source code would probably help though.
*I can haz a cookie?*
|
|
|
|
|
Hi, I have a HANDLE which is an unnamed pipe, so I can't open it the usual way with fopen.
I want to use stdio functions like fscanf on it, so I'm looking for a way to obtain a FILE* from that HANDLE.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Never mind, I found out how - _fdopen.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
I have C++ Win32 app that uses HttpSendRequest to request some URL (via https). It worked OK earlier; but then errors ERROR_INTERNET_INCORRECT_HANDLE_STATE began happen. Why these ones? Any ideas?
|
|
|
|
|
Hi,
googling for ERROR_INTERNET_INCORRECT_HANDLE_STATE (which you should have done already) I stumbled on this[^] which might apply.
|
|
|
|
|
hi all
i m working With RAPI functions.
sometimes CeRapiInitEx or CeRapUnInit function not returns the pointer.
please tell me how can i resolve this.
thanks in advance.
|
|
|
|
|
|
debug cursor or pointer not return when execute CeRapiInitEx
|
|
|
|
|
the eagle flies at midnight
|
|
|
|
|
I thought it was Balrock and NoName[^] that started at midnight? Not to mention the bimbos they have on.
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
hi friends
please me any body.........
how to convert CString Unsigned short and short to CString
|
|
|
|
|
|
Richard MacCutchan wrote: atoi()[^].
Yet better _ttoi (the generic text mapping routine), so you don't have to make changes to the code for an Unicode build. Do I get the nitpick cookie?
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh R Subramanian wrote: Do I get the nitpick cookie?
No, but I get the "you forgot about MBCS/Unicode" cookie.
It's time for a new signature.
|
|
|
|
|
Hi,
I have C++ DLL, which export set of API's using (dllexport), API uses STL container classes as input and output parameters.
I can successfully compile using VS 2005 and able to to use in other C++ program compiled under VS 2005.
Now if i try to use C++ DLL which compiled using VS 2005, for other C++ porject compiled using VS 2010 then i see crash in STL container class code. However if i compile above C++ DLL using VS 2010 then i can use this DLL for other program compiled using VS 2010.
One intresting thing i noticed, if i not use any STL datatype in C++ DLL API (as input and output params) then i can use in programs compiled under VS 2010 even though C++ DLL is compiled using VS 2005.
|
|
|
|
|
|
So do you suggest any solution. I need to make use of VS2005 binaries into VS 2010 project.
|
|
|
|
|
The Visual Studio help has the following snippet under vector<>.front:
#include <vector><br />
#include <iostream><br />
<br />
int main( )<br />
{<br />
using namespace std; <br />
vector <int> v1;<br />
<br />
v1.push_back( 10 );<br />
v1.push_back( 11 );<br />
<br />
int& i = v1.front( );<br />
const int& ii = v1.front( );<br />
<br />
cout << "The first integer of v1 is "<< i << endl;<br />
i++;<br />
cout << "The second integer of v1 is "<< ii << endl;<br />
}
It is said to produce:
The first integer of v1 is 10
The second integer of v1 is 11
I'm confused. Just how is this the second integer of v1. Seems to me that the first integer of v1 was simply incremented and happens to have the same value as the second integer. If so, the author of this page should be sacked for writing a deliberately confusing entry.
|
|
|
|
|
since front returns a reference, then i and ii are "pointing" to the same value, that's why ii == 11.
http://msdn.microsoft.com/en-us/library/0z70c7a5.aspx[^]
from the above page, see that the second cout is different from your example...
using namespace std;
vector <int> v1;
v1.push_back( 10 );
v1.push_back( 11 );
int& i = v1.front( );
const int& ii = v1.front( );
cout << "The first integer of v1 is "<< i << endl;
i++;
cout << "Now, the first integer of v1 is "<< i << endl;
Watched code never compiles.
|
|
|
|
|
also check the address of i and ii you will see they are the same.
Watched code never compiles.
|
|
|
|
|
Well it seems my online help is old. Need to update and/or switch to web help.
|
|
|
|
|
|
Peter Camilleri wrote: If so, the author of this page should be sacked for writing a deliberately confusing entry.
I agree. Not a lucky sample.
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]
|
|
|
|
|
If I attempt to download http://www.codeproject.com/App_Themes/Std/Img/logo225x90.gif
It returns bad request with the code used below.
Download->HostFileLocation has /App_Themes/Std/Img/logo225x90.gif in UNICODE format stored in it.
#define DEFAULT_BUFLEN 512
char HTTPrequest[DEFAULT_BUFLEN];
char *HostFileLocation = new char[wcslen(Download->HostFileLocation)+1];
wcstombs(HostFileLocation, Download->HostFileLocation, wcslen(Download->HostFileLocation)+1);
char *Host = "www.codeproject.com";
char *UserAgent = "MyPrivateDownloader b86";
sprintf(HTTPrequest,"GET %s HTTP/1.1\r\nHost: %s\r\nUser Agent: %s\r\nAccept: */*\r\nAccept-Encoding:\r\n\r\n", HostFileLocation, Host, UserAgent);
send(IPv4,HTTPrequest,strlen(HTTPrequest),0);
However if I use. HTTP/1.0
sprintf(HTTPrequest,"GET %s", HostFileLocation);
send(IPv4,HTTPrequest,strlen(HTTPrequest),0);
Everything goes smoothly.
I appreciate any help I can get on this matter.
|
|
|
|