|
Right Click on the List Control and check "sort" property
V
|
|
|
|
|
I am trying to decide which non-MFC CString implementation (ie. just standard C++) is the best (ie. fast, stable/bug free, plenty of functionality). I have found the following classes on CP, but cannot decide which one to use....
http://www.codeproject.com/string/stdstring.asp
http://www.codeproject.com/string/yasr.asp
I am verging towards stdstring.asp but would appreciate any feedback and suggestions as to why one is better than another, including any suggestions for others I have not listed.
|
|
|
|
|
IMO you are far better served to use STL. It has a bit of a steep learning curve, especially if you aren't into templates but you will be well rewarded. And of course STL does much more than just strings and is portable.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Neville Franks wrote:
It has a bit of a steep learning curve
Well, if he just wants to use std::string, there's not much of a learning curve involved I guess. Should be fairly simple.
|
|
|
|
|
<br />
int main(int argc, char* argv[])<br />
{<br />
long start=0,length=0;<br />
char *pByte=(char*)malloc(sizeof(char)*10);<br />
if(pByte==NULL)<br />
return -1;<br />
memset(pByte,1,10);<br />
ofstream fout("test.bmp",ios::out);<br />
if(!fout)<br />
{<br />
return -1;<br />
}<br />
fout.write(pByte,10);<br />
free(pByte);<br />
fout.close();<br />
return 0;<br />
}<br />
I debug this program with boundscheker,the bc report that there are 160 bytes memory leak which at
<br />
if ( (p = (_PVFV *) _realloc_crt(__onexitbegin,<br />
_msize_crt(__onexitbegin) +<br />
ONEXITTBLINCR * sizeof(_PVFV))) == NULL )
these code was copy from "..\Microsoft Visual Studio\VC98\CRT\SRC\onexit.c"
I do not know where I am wrong at.
please anybody help me!
Don't look at me in that way!
|
|
|
|
|
Well, once possible leak is after if(!fout) - At that point in your program you exit, without freeing pByte
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
the program goes well.
and the fout always has correct value!
if I use fopen,fclose.
the BoundsChecker report nothing
example:
<br />
char buff[]="11111";<br />
FILE* pFile=fopen("www.txt","w+");<br />
if(!pFile)<br />
return;<br />
fwrite(buff,1,5,pFile);<br />
fclose(pFile);<br />
Don't look at me in that way!
|
|
|
|
|
Maybe closing the file handle first will flush the buffer and you will be okay
fout.write(pByte,10);
fout.close(); // <- call this before freeing memory
free(pByte);
|
|
|
|
|
the meory leak as before!
<br />
char *buff=new char[7];<br />
strcpy(buff,"123456");<br />
ofstream fout("test.txt",ios::out);<br />
fout.write(buff,6);<br />
fout.close();<br />
delete[] buff;<br />
I hope it's boundschecker wrong!
Don't look at me in that way!
|
|
|
|
|
HI,
I have a procedure inside a package. I am trying to execute it using the call syntax. But while trying to prepare the statement i get an Syntax Error or Access Violation error with a SQL state of 37000. I try executing other procedures from the same package it executes properly. Dunno why this is giving a problem. Any suggestions.
Regards,
Mihir Shroff
|
|
|
|
|
provide the code snippet
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
HSTMT hStatement = NULL;
m_strSQLState = "";
m_strErrorString ="";
m_lNativeError = 0;
if( !m_pConnection )
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"No Database connection exists");
return FALSE;
}
if(strSQL == "")
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"Not a valid SQL statment");
return FALSE;
}
if (bDisplaySQL)
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"[ActionQuery] SQL Statement is:" + strSQL);
}
RETCODE rCode;
HDBC hDbc = m_pConnection->m_hODBC;
HENV hEnv = m_pConnection->m_hEnv;
//Allocate the statement
rCode = ::SQLAllocStmt(hDbc,&hStatement);
if(rCode != SQL_SUCCESS)
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"SQLAllocStmt Error");
CheckSQLError(hStatement);
return FALSE;
}
rCode = ::SQLSetStmtOption(hStatement,SQL_CONCURRENCY,SQL_CONCUR_VALUES);
if( (rCode != SQL_SUCCESS) && (rCode !=SQL_SUCCESS_WITH_INFO) )
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"SQLSetStmtOption Error:");
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"[Warning]Lock during action query may not be available");
CheckSQLError(m_hStatement);
}
//Prepare the allocated statement
rCode = ::SQLPrepare(hStatement,(unsigned char*)LPCTSTR(strSQL),strSQL.GetLength() );
if(rCode != SQL_SUCCESS)
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"SQLPrepare Error:");
CheckSQLError(hStatement);
::SQLFreeStmt(hStatement,SQL_DROP);
return FALSE;
}
//Execute the prepared SQL statement
rCode = ::SQLExecute(hStatement);
if((rCode != SQL_SUCCESS) && (rCode != SQL_SUCCESS_WITH_INFO))
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"SQLExecute Error");
CheckSQLError(hStatement);
::SQLFreeStmt(hStatement,SQL_DROP);
return FALSE;
}
::SQLFreeStmt(hStatement,SQL_DROP);
return TRUE;
and strSQL = "{call MTMS_TCMD.FMForLoad(82,'ETR Data not available!')}";
Regards,
Mihir Shroff
|
|
|
|
|
Hello guys,
I'm writing a simple demo application that have to display two DB tables data refreshed every X seconds.
To do so, I'm using two MS DataGrid Controls in a Dialog Box... it works perfectly, but I'd like to add different row colors depending on a column value (ie: the table PROCESS displays different process statuses and for terminated process I would display a green line, for failed processes a red one and so on...).
Someone has alredy done so, or has someone a good tip for me?
Thanx,
Fabio
|
|
|
|
|
hiho
i read a book about linux networking and it describes some techniques for a server
but my question is more about software architecture than linux programming
so i post it here
1. multiplexing (select())
2. multiprocess (fork())
3. multithreaded (pthread's)
i understand the architecture of a process pool in which every process holds a thread pool where every thread calls accept on a socket to get the connection
the kernel then makes the decision which thread gets the connection
and that's why i don't understand multiplexing
because i think multiplexing does exactly the same
you use select to wait for a connection (or a descriptor to change its state) and then make accept
but if this can the kernel do for you
what is a multiprocessed, multithreaded multiplexing server good for?
or what exactly is a multiplexing server compared with a multiprocesses/multithreaded server?
thx@ll
|
|
|
|
|
Multiplexing is easy. It is a technique to handle multiple sockets with only one thread.
You use a loop with a call to select to detect action on every single socket to be able to answer requests for example!
This needs less resources than multi-threading or even forking.
Don't try it, just do it!
|
|
|
|
|
but i don't need multiple sockets!
i just need to listen on one socket!
does it make sense if i only need to listen on one socket?
|
|
|
|
|
How can i make my edit box look like below?
------------------------
|xxxx-xxxx-xx |
------------------------
The user is allowed to edit the x only
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
How can i make my edit box look like below?
by using several editboxes side by side ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
IP contorl'd be of any use??? xxx.xxx.xxx.xxx??
V
|
|
|
|
|
don't worry i find out how.
Click here if u are interested.
/\|-||\/|/\|)
|
|
|
|
|
You have to validate every modification in the control by processing all the EN_CHANGE messages on the CEdit.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
hi,
my name is aditya. i am new to vc++. i am trying to create a ftp application. what i want to know is when we connect to a ftp site. there are many directories on the site(apart from the files). so how can i see the contents of the directories or download the whole directory present there.
aditya
|
|
|
|
|
From the RFC[^]:
LIST (LIST)
This command causes a list to be sent from the server to the
passive DTP. If the pathname specifies a directory or other
group of files, the server should transfer a list of files
in the specified directory. If the pathname specifies a
file then the server should send current information on the
file. A null argument implies the user's current working or
default directory. RFCs are good. Use them!
--
An eye for an eye will only make the world blind.
|
|
|
|
|
I used vc++6.0 to buid the windows DiretShow simple code playcap and got the link error 2001.
How to settle this problem?
Thanks!
momer
|
|
|
|
|
what does the linker say ??????
it doesn't find _main ...
what does that mean ???
you must have a main() function in your code, which is the entry point of your program...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|