|
char **argv = NULL;
argv = (char**)malloc(3*sizeof(char*));
argv[1] = (char*)malloc((20)*sizeof(char));
argv[1] = "D:\\Input.jpg";
cout<<argv[1];
Its working guy.
|
|
|
|
|
thanks for your replay ..sir
char **argv = NULL;
argv = (char**)malloc(3*sizeof(char*));
argv[0] = argv1[0];
argv[1] = (char*)malloc((20)*sizeof(char));
argv[1] = "D:\\Input.jpg";
::MessageBox(0,(LPWSTR)argv[1],(LPWSTR)"test",0);
the output of message box string is showing unknown square box .. i dont know why sir ..please replay
thanks
|
|
|
|
|
char **argv = NULL;
argv = (char**)malloc(3*sizeof(char*));
argv[1] = (char*)malloc((20)*sizeof(char));
argv[1] = "D:\\Input.jpg";
::MessageBox(0,(LPCTSTR)argv[1],(LPCTSTR)"test" ,0);
|
|
|
|
|
PrafullaShirke27 wrote: argv[1] = (char*)malloc((20)*sizeof(char));
argv[1] = "D:\\Input.jpg";
What's the purpose of the above sequence?
[added]
I reckon it was already in the OP post.
[/added]
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]
|
|
|
|
|
|
O riginal P oster's message.
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]
|
|
|
|
|
raju_Code wrote: char **argv = NULL;
argv = (char**)malloc(3*sizeof(char*));
argv[0] = argv1[0];
argv[1] = (char*)malloc((20)*sizeof(char));
argv[1] = "D:\\Input.jpg";
::MessageBox(0,(LPWSTR)argv[1],(LPWSTR)"test",0);
What a mess! Try:
TCHAR * argv[3];
argv[1] = _T("D:\\Input.jpg");
::MessageBox(0, argv[1],_T("test"),MB_OK);
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]
|
|
|
|
|
raju_Code wrote: argv[1] = (char*)malloc((20)*sizeof(char));
argv[1] = "D:\\Input.jpg";
Why bother allocating memory if you are just going to reassign the pointer?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
hi everybody.
in my vc++ application cannot insert data into database....
success fully inserting to passing values...using this code line
SQLExecDirect(hstmt,(unsigned char *)"insert into emp values(222,'shan',5676)" ,SQL_NTS);
but using varibles(dynamically) cannot inserting.
SQLINTEGER empnum=1006;
SQLVARCHAR ename[20]="weewe";
SQLFLOAT esal=5656;
SQLExecDirect(hstmt,(unsigned char *)"insert into emp values(empnum,'ename',esal)",SQL_NTS);
please solve this porblem......
thanks in advance......
|
|
|
|
|
eswar pothula wrote: SQLExecDirect(hstmt,(unsigned char *)"insert into emp values(empnum,'ename',esal)",SQL_NTS);
Code is treating (empnum,'ename',esal)as the values and not as variable...So this code tries to insert string into Interger data type for the colum Emp number and salary and so it errors out
If you want to dynamically assign the values, my sugesstion would be bind the parameters using
SQLBindParameter and execute using
SQLExecute
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
modified on Tuesday, November 3, 2009 5:21 AM
|
|
|
|
|
eswar pothula wrote: SQLExecDirect(hstmt,(unsigned char *)"insert into emp values(empnum,'ename',esal)",SQL_NTS);
That's wrong.
Try to change it to:
const int SIZE = 256;
char sqlcmd[SIZE];
sprintf(sqlcmd, "insert into emp values(%d,'%s',%f)", empnum, ename, esal);
SQLExecDirect(hstmt,(unsigned char *) sqlcmd, SQL_NTS);
of course, in real life, you should check for buffer overruns, etc...
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]
|
|
|
|
|
Hi All,
I have a dialog based application and are there any general scenarios where i can make the application hang.
Thanks,
Hari
|
|
|
|
|
Hari_16 wrote: I have a dialog based application and are there any general scenarios where i can make the application hang
There are quite a lot, I suppose.
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]
|
|
|
|
|
Can u name some of them.....
|
|
|
|
|
Well it is difficult to point some, until and unless knowing your intentions
Величие не Бога может быть недооценена.
|
|
|
|
|
Honestly .. no specific intentions just had some crashes and fixed it .. so was thinking of ways to hang an application .
In my project i use multithreading and critical section to synchronise them....
|
|
|
|
|
Multithreading and synchronization is not more than enough for a dead lock.
Just check the the various conditions of dead lock.
have to home work on your operating system knowledge
Just refer Modern operating systems from Andrew S. Tanenbaum.
I love this book
Величие не Бога может быть недооценена.
|
|
|
|
|
If you do not use a critical section, that won't make your application "hang". You'll possibly lose out on data corruption due to race condition, but the threads will continue to execute and at worst you'll take a nasty crash (like an access fault).
But a using or not using a critical section won't have anything to do with a "hang", unless a thread is being a dog and locking a resource (for a long time) that the UI thread is waiting for. But that boils down to my other reply that I've posted to your original query.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
You may put an infinite loop somewhere.
Your thread may wait for a dead synchronization object.
A blocking I/O function call...
[added]
You may even lauch Eclipse, for the purpose
[/added]
There are quite a lot ways for you, to make it happen...
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]
modified on Tuesday, November 3, 2009 5:28 AM
|
|
|
|
|
|
You want to construct or Destruct the application ?
|
|
|
|
|
At the moment Destruct
|
|
|
|
|
By "hang", I assume that an application becomes unresponsive? If that's it, then blocking the UI thread would be almost the only reason why it happens.
For example, if there's a lengthy calculation of some sort, like parsing a huge file, then that should be done on a separate thread.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
|
Hari_16 wrote: where i can make the application hang
I am not sure why you want to hang your own thread but this should work:
SuspendThread(GetCurrentThread());
Best Wishes,
-David Delaune
|
|
|
|