|
So have a char array:
char* buf="/sys/class/gpio/gpioX/direction"
And set the value at 'X'
*buf+20 = <whatever you="" want="">
|
|
|
|
|
Nice, but than I need to count the pointer where the insertion goes.
Which in my case is constant, so not big issue.
Thanks for your contribution .
Cheers
|
|
|
|
|
You can always count backwards from the end, find the first / and insert the value before that.
String parsing like this, C style, is done a heck of a lot. It is light weight and very quick.
|
|
|
|
|
I have 2 windows, let's say a FileZilla window and a Notepad Window. And I have the FileZilla window is on the top of the Notepad one (like cards; on above the other).
I want to know how could I get the information that the FileZilla window is above the notepad's one ?
I tried GetWindowLong But no chance.
LONG wndState1 = ::GetWindowLong(handler1, GWL_EXSTYLE);
LONG wndState2 = ::GetWindowLong(handler2, GWL_EXSTYLE);
both results is equal to 256.
Is there a trick for that ?
"The Only Limit Is Only Your Imagination."
modified 15-Dec-17 11:52am.
|
|
|
|
|
Try calling EnumDesktopWindows. I think it will give the window handles in their z-order to the callback function. I am not sure about this though. It would be fairly easy to contrive a test app to experiment with it. You might find EnumWindows will do it also. Between the two you should be able to determine what you want. Once you get the window handles in their z order you will have to determine which window is which, likely by their titles.
|
|
|
|
|
|
I need smthing that works with c++.
"The Only Limit Is Only Your Imagination."
|
|
|
|
|
If you can do C++, then you can surely translate from C#. Especially since the functions you need to call are right in the code.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Windows API has the function GetTopWindow
GetTopWindow function (Windows)[^]
From the TopWindow you want walk down thru the chain via GetNextWindow
GetNextWindow function (Windows)[^]
So in your case you want to ask the topWindow of the window that contains both FileZilla window and a Notepad Window. You can then walk along the chain using GetNextWindow and see which is above which just by asking the window title.
Something like this will work
char buf[256];
HWND Wnd = GetTopWindow( );
GetWindowText(Wnd, &buf[0], sizeof(buf));
while (Wnd != 0 && !stricmp(&buf[0], "FileZilla") && !stricmp(&buf[0], "NotePad"))
{
Wnd = GetNextWindow(Wnd, GW_HWNDNEXT); GetWindowText(Wnd, &buf[0], sizeof(buf)); }
if (Wnd == 0) {
}
else {
}
It is equivalent to
EnumChildWindows function (Windows)[^]
However for the simplicity you have it isn't worth setting up the enumeration function.
In vino veritas
|
|
|
|
|
Is there an Api to implement exception handling on function/frame thread basis without the _try _except/_catch statements as that limits me to only certain type of exceptions
It would be nice to have an api on a function or frame Even on a thread basis
The function and the frame saves the programmer from doing unwinding
with AddVectoredExceptionHandler I catch everything but then I have to figure out from which function the exception occurred
Thanks
|
|
|
|
|
it's been 2 days. i'm struggle with this things. this's still new. the documented it just only help a bit. i want to check session created or not. a.k.a Connected or not. i don't know why the developer MySQL make new terms to call a thing. in this code. everytime i change something credential thing like host, port, user,pass. it return same. and return unexpected result with long zero 00000000000000 if use cout to sess. in my server i already enable X Plugin. my enviroment is Visual Studio Community 2017 c++ desktop.
#include <iostream>
#include "mysql_xapi.h"
using namespace std;
int main()
{
mysqlx_session_t * sess;
char conn_error[MYSQLX_MAX_ERROR_LEN];
int err_code;
sess = mysqlx_get_session("127.0.0.1", 3306, "root", "root", "test", conn_error, &err_code);
if(!sess)
{
cout << "It's not connect";
}
else
{
cout << "It's connect";
}
mysqlx_session_close(sess);
return 0;
}
|
|
|
|
|
The function provides an error code and an error message upon failure. So print those out to get information on what went wrong:
sess = mysqlx_get_session("127.0.0.1", 3306, "root", "root", "test", conn_error, &err_code);
if (NULL == sess)
{
cout << "Connection failed; error " << err_code << ": " << conn_error << endl;
}
|
|
|
|
|
The error nothing helping. it shows string unexpected result and integer 1.
can u figure out when the error like that? i think can't.
|
|
|
|
|
I would expect a meaningful error message if one the parameters is wrong.
That generic message might indicate that it is networking problem. Because you are using localhost (127.0.0.1) it is probably not due to blocking by a firewall. You should check the port number and ensure that it is the port on which your server is listening.
Depending on the operating system, you might also us a command line utility to show listening ports (as root/adminstrator: Linux: lsof -nPi , Windows: netstat -ban ).
|
|
|
|
|
Hi,
int x=11;
printf("%d %d %d ", x++,++x,++x);
It prints 13 14 14, But I thought 13 14 15
Why ?
|
|
|
|
|
Because you should never use such expressions. The compiler writers are allowed to handle the order of incrementation in any way they like, so the results may or may not be what you expect. Bottom line: don't do it.
|
|
|
|
|
I agree. but my doubt was how it happens.
|
|
|
|
|
|
|
It isn't a good answer it's wrong the result is undefined.
Try it on VS2017 and you will likely get "13 13 13 " because of the way the optimizer works.
In vino veritas
|
|
|
|
|
This expression is undefined by the C Standard, meaning that the compiler can do anything with it, including formatting your disk or causing demons to fly out of your nose. You should consider yourself lucky that the compiler only incremented 'x' in a weird manner.
Note that even changing the compiler options (e.g. optimization) might change the printed results, so even if this "appears to work properly" on your system - DON'T DO IT!
(On comp.std.c and comp.lang.c they used to refer to a notional system, the DeathStation 9000, that would actually create Nasal Demons when it encountered undefined expressions )
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
thank you .. 
|
|
|
|
|
Hi,
Is there a data type wchar_t in C?If so, how it differ from char?
|
|
|
|
|
Quote: Is there a data type wchar_t in C? Yes, apparently[^].
Quote: If so, how it differ from char? It is compiler dependent.
|
|
|
|
|