|
*sigh* If you have a variable called szAuth, and you want to build an SQL search string for it, the search string needs the VALUE of szAuth in quotes. Like this:
"SELECT * from books where Author='" + szAuth + "'"
NOT
"SELECT * from books where Author=" + "szAuth"
and not
"SELECT * from books where Author=" + szAuth
either
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Oh right, sorry I did not quite understand what you meant. I have changed that but now I am getting an error about "cannot add two pointers." I am looking on google for what this is but if you could help that would be great. At the moment I understand its something to do with using the + but im not exactly sure what.
|
|
|
|
|
Use a class like string or CString to hold your query, because otherwise, you're trying to add two char*, and you can't do that. you could use strcat, but there's no reason not to use C++
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ok, thankyou for all of your help.
|
|
|
|
|
Hello,
I have a web service un C# and a client in C++ that uses this web service without problems. Right now the aplication in VC++ is a simple console aplication and I need to modify it to make it a DLL. I have followed the basic steps to do this and also created another aplication (a console application also in VC++) that calls a function exported by my DLL to use the webservice but now when I try to run it I get the following error:
ATLSOAP: CSoapRootHandler::InitializeSOAP -- failed to get SAXXMLReader.
I don't get any errors when I compile my solition.
Unfortunately I haven't found any reference to this problem and I don't know what I am doing wrong.
Thank you so much for any help.
Yas
PS. I am using visal studio .net and .NET framework 1.1.
|
|
|
|
|
I created a c++ program that creates a dictionary file. the problem is that it won't go any larger than 4Gb. Is there any way around this limit?
|
|
|
|
|
I assume we are talking about NTFS here. Doesn't that system have a maximum volume size of 4GB? If not, then you are probably being plagued by the API you are using. The maximum size of an unsigned int is 4GB.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
If it does then how can I get around that max size? Is a way to create another file once that limit is reached?
|
|
|
|
|
Andrew Admire wrote:
If it does then how can I get around that max size?
Use a type that can store values larger than 232, perhaps.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Is there a way to generate files in C++? So I can get around the file limit size?
|
|
|
|
|
Technically, no. C++ knows nothing of file I/O. You can, however, use things like:
CFile
fopen()
CreateFile()
ostream But those will not get you any further than you already are.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Would I be able to limit the file that prog creates then write a line that states if you reach x size then create another file and contine?
|
|
|
|
|
I don't see why not.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am new to all of this. Could you point me in the right direction?
|
|
|
|
|
What method are you currently employing to create the file?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
ofstream outClientFile ("diction.txt", ios::out);
|
|
|
|
|
Ok, so what methods of the ofstream class are you using to write to the file? How are you verifying that the file has maxed out at 4GB? Perhaps you could put together a small program, similar to what Rick did except use ofstream , that exhibits the problem.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
According to the MSDN website, the max size for a file on FAT32 is 4GB and under NTFS it is 16TB. I just tried a little experiment here and was able to write a file of 5GB on a system using NTFS. I used fopen to create the file and fprintf to write to it. FWIW, it took 163.2 seconds to write the file with some diagnostics output occuring. I would attempt bigger files but I didn't want to spend the time.
|
|
|
|
|
Rick York wrote:
FWIW, it took 163.2 seconds to write the file...
Nothing wrong with that. I wonder how long it would take the SetFilePointer() /SetEndOfFile() pair to do something similar.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The book I'm using does not have those commands in it. Would you be kind enough to send me a sample code using those two commands?
|
|
|
|
|
Here's my testing program :
int main( int argc, char* argv[] )
{
FILE *fp = fopen( "C:\\Temp\\BigFile.txt", "wt" );
if( ! fp )
{
fprintf( stderr, "Unable to open temporary file\n" );
return -1;
}
int megcount = 0;
if( argc > 1 )
megcount = atoi( argv[1] );
if( megcount < 100 )
megcount = 100;
const __int64 onemeg = 1000000;
__int64 max = megcount * onemeg;
fprintf( stdout, "Beginning file writing of %d MB\n", megcount );
const int writeincr = 20000000;
int wcount = 0;
CElapsed et;
double start = et.Elapsed( 0.0 );
__int64 total = 0;
__int64 lines = 0;
const char *format =
"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234 line %8I64d\n";
while( total < max )
{
int count = fprintf( fp, format, lines );
total += (__int64)count;
wcount += count;
if( wcount >= writeincr )
{
wcount = 0;
int meg = (int)( total / onemeg );
double amount = et.Elapsed( start );
fprintf( stdout, "%4d megabytes have been written : %.1f seconds elapsed\r",
meg, amount );
}
++lines;
}
double elapsed = et.Elapsed( start );
fclose( fp );
fprintf( stdout, "\n\noutput file has been closed - %I64d lines were written in %.1f seconds\n",
lines, elapsed );
return 0;
}
The CElapsed class is one I wrote and contributed to codeguru years ago. It's use can be removed from the code if you want. It's only used in the diagnostic output.
This is just a hacked-together testing program that took about five minutes to write. It's not exactly an example of excellent code.
|
|
|
|
|
How would I be able to use fprintf to write this to a file?
for (int a=0; a<10; a++)
{
for (int aa=0; aa<10; aa++)
fprintf(outClientFile,a,aa)endl;
}
|
|
|
|
|
In case you want it - here's the CElapsed timer. I use it for high-resolution timing. It typically has a an overhead of around 2uS, depending on CPU, so it can usually time to within 10uS.
#ifndef _CELAPSED_H
#define _CELAPSED_H
#else
#error repeated include of this file
#endif
class CElapsed
{
private :
double m_Period;
int m_Initialized;
__int64 m_Frequency;
public :
CElapsed()
{
m_Initialized = QueryPerformanceFrequency( (LARGE_INTEGER *)&m_Frequency );
if( ! m_Initialized )
m_Period = 0.0;
else
m_Period = 1.0 / (double)m_Frequency;
}
double Elapsed( double begin=0.0 )
{
__int64 endtime;
QueryPerformanceCounter( (LARGE_INTEGER *)&endtime );
double endsecs = endtime * m_Period;
return endsecs - begin;
}
BOOL Initialized()
{ return m_Initialized; }
__int64 GetFreq()
{ return m_Frequency; }
double FromMilliSecs( UINT millisecs )
{ return 0.001 * millisecs; }
void Delay( double amount )
{
double delta;
double delaytime;
double start = Elapsed( 0.0 );
while( true )
{
delaytime = Elapsed( start );
delta = amount - delaytime;
if( delta <= 0.0 )
break;
if( delta > 0.0012 )
Sleep( 1 );
}
}
};
|
|
|
|
|
Hi,
I have created a Comboboxex and it doesn't send message for WM_MOUSEMVOE. So i can't add a tooptip control above it. I tried but it still doesn't work. Here is my code for creating Comboboxex:
hWndFontCombo = CreateWindowEx (
0, // extended styles
"ComboBoxEx32", // extended combo box – will
str, // default text
WS_VISIBLE | WS_CHILD | WS_TABSTOP |
WS_VSCROLL | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NORESIZE |
CBS_AUTOHSCROLL | CBS_DROPDOWN,
rect.right,0, // x, y
MIN_COMBOCX-8, // width
2* cy * NUM_FONT_TYPE, // height
hWndParent, // parent window
(HMENU)ID_COMBO, // ID
hInst, // current instance
NULL ); // no class data
Can anyone tell me how I can display the tooltip for this comboboxex? Thanks a lot.
|
|
|
|
|
Why are you creating the control at runtime rather than at design time? In any case, has EnableToolTips() been called? Are you handling the TTN_NEEDTEXTA and TTN_NEEDTEXTW notifications?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|