|
You should post your request in the 'plz sir send me codez plz plz' one.
BTW you lost 100 man points for attempting to avoid pointers.
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]
|
|
|
|
|
CPallini wrote: BTW you lost 100 man points for attempting to avoid pointers.
HA! 5.
|
|
|
|
|
|
Hi all,
Please let me , if you know anything about windows time providers(http://msdn.microsoft.com/en-us/library/ms725475%28VS.85%29.aspx[^]).
i want to
1. Sync my local machine time with any NTP server.
Is there any other method to do that.
I think, this is possible only through Windows Time Providers...
Thanks in advance
BIJU
|
|
|
|
|
Creating and implementing a time provider is different than simply communicating with a NIST server.
bijumanjeri wrote: i want to
1. Sync my local machine time with any NTP server.
Using sockets, you can use the DAYTIME protocol to connect to 129.6.15.28, port 13. I assume using the NTP protocol (port 123) is just as easy.
"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
|
|
|
|
|
Thank you David for your very quick response.
OK. Let me check with your suggestion.
BTW..
by going through the MSDN, I think, by using w32time.dll, we can control the Windows Time Service.
like forcefully sync with external NTPs. But how can we access the Windows Time Service?
Is there any APIs available for controlling the Windows Time Service?
Please help me.
Thanks
BIJU
|
|
|
|
|
bijumanjeri wrote: like forcefully sync with external NTPs.
Just for clarification purposes, NTP is the protocol used to communicate (ie, synchronize) with a (NIST) computer.
bijumanjeri wrote: Is there any APIs available for controlling the Windows Time Service?
To control services via code, see here.
"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
|
|
|
|
|
Sorry David.. Sorry for the mistake. Hope you understand what i meant.
Let me try my luck..
Regards,
BIJU
|
|
|
|
|
|
Thank you guys.. Thank you for your suggestions..
|
|
|
|
|
Here is a void* problem to challenge you. I have a very large application A. Sometimes it needs to use a little application B. B instantiates an external dll I didn't write, we can call it G. B uses DllExport to export some functions I can call with DllImport. Whenever I call B it makes a new G and deletes it again. Fine.
Now they changed the rules. I can only have one G. Easy, I think. Add an Init function to B's external interface, call it to instantiate my single instance of G. Return a void* to B, so whenever I want to call it it reuses the instance of B and thus of G. A is not allowed to know what happens in B, so the void* is perfect. I keep void* mPointerToB as a member of A.
B has some internal classes, we can call one ClassM. So B contains a member ClassM mM. When I hop into B it runs for a while until it tries to call mM.function. Then I get a buffer overrun.
So I googled and found this statement. "A void pointer cannot point to a class member in C++." Is my void pointer to B losing its internal objects along the way? Where can I find out more? Am I doing this in the wrong way?
This is C++ in Visual Studio 2008. I use void* in other places to access pointers to things in Ada functions in the same way, so it should work, I think.
-------------
Ave computer! Hackitura te salutat!
(I just made this up. Just to show you can hack Latin as well as C++.)
|
|
|
|
|
RedSonja wrote: When I hop into B it runs for a while until it tries to call mM.function. Then I get a buffer overrun.
What do you mean by 'hop into B', how are you executing the functions in B?
RedSonja wrote: So I googled and found this statement. "A void pointer cannot point to a class member in C++." Is my void pointer to B losing its internal objects along the way? Where can I find out more? Am I doing this in the wrong way?
I'm not sure if this statement applies here. As you say you can use a void* to hold a pointer to anything, it is only when you use it to access the object it points to, that you may run into problems. If the void* points to an instance of a class then you would have to cast it to a CLASS* in order to use the object.
Buffer overrun can be caused by a multitude of sins and if it is in the dll then you probably need to talk to the dll's developers for assistance.
|
|
|
|
|
Sorry, I was not very clear:
I hop into B by calling a function B declares as DllExport, and A sees as DllImport. B has a dll and a lib and A can see them. This has always worked OK when I called it "fresh" every time.
B's internal objects - static instances of B's classes - seem to be null when I go into B using the void* - I get the buffer overrun when I call functions of an internal object. (I am not allowed to use dynamic allocation "because the code is safety critical". This makes things very hard.) When I call B I import the stuff like this:
DllExport int BDoWork(
struct BigDataBlock1 *pBigDataBlock1,
struct BigDataBlock2 *pBigDataBlock2,
void* pB)
I turn the void* back into a proper pointer like this:
BWrapper* pmyB = (BWrapper*)pB;
and it works OK, I can import data along with the pointer, and it seems to be alright, I can copy the data into B's internal structures. I use ASSERT when copying.
B was written by myself. Respectable code always has a few bugs. I am sure there are still a few in there. What should I be looking for? It imports and handles very large amounts of data; I already had to cut the data into slices to avoid overflowing buffers on the dll call. I made it a dll so I could go into B with the debugger when debugging A. (Visual Studio is cool; it can even hop into Ada dlls, can you imagine?)
You helped me a lot by saying void* should work the way I use it. Now I suppose the bug is inside B so I can concentrate there.
-------------
Ave computer! Hackitura te salutat!
(I just made this up. Just to show you can hack Latin as well as C++.)
|
|
|
|
|
Your casting of the void* looks correct and, as you say, allows you to process things as you would expect.
RedSonja wrote: Now I suppose the bug is inside B so I can concentrate there.
I think you probably answered your own question, something inside B may not be behaving correctly. Looks like some long hours stepping through the debugger - good luck.
|
|
|
|
|
Found it!
Some external dll (G) I was using in B had an interface using CString. Since I am not allowed to use MFC, I redefined these to be string. I don't actually use these parts. Anyway, string is not the same as CString and this was causing an access violation, even though it compiled and linked, the rat.
I solved this by taking a local copy of the G.h file of the external dll. In it I put includes so it could see CStrings. This actually makes the exclusion of MFC in my own code redundant, but I can't help that. The G people are not willing to work without MFC (neither was I actually).
G also had some problems in its export functions, which are being repaired. We are pleased to find these bugs now and not after delivery.
-------------
Ave computer! Hackitura te salutat!
(I just made this up. Just to show you can hack Latin as well as C++.)
|
|
|
|
|
Hi all,
I am working on serial port application on VC6 using non overlapped IO.
I used the following time out values.
ReadIntervalTimeout = 1;
ReadTotalTimeoutMultiplier =1;
ReadTotalTimeoutConstant =2;
In XP operating system for these settings my application is working fine.
But when I use these settings in windows 2000, the application does not send and receive properly.
In 2000, if I change the settings to
ReadIntervalTimeout = 0xffffffff;
ReadTotalTimeoutMultiplier =0;
ReadTotalTimeoutConstant =0;
it works properly.But If I use these values, my application receiving thread shows CPU usage much high.
Are the settings for read interval are correct? Please clarify..
Regards,
Sunil Kumar
|
|
|
|
|
sunny_vc wrote: ReadIntervalTimeout = 1;
ReadTotalTimeoutMultiplier =1;
ReadTotalTimeoutConstant =2;
Why such low values?
What is your communication speed?
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]
|
|
|
|
|
My application is communicating at 115200 baud rate speed with an
embedded device.
Regards,
Sunil Kumar
|
|
|
|
|
Is the problem that you receive part of the total string from the external equipement?
Is the comunication an answer and a response, or full duplex?
|
|
|
|
|
Hi All VC++ Programmers,
I am working on a project that is to be migrated from vs-2003 to vs-2008.In my application i have 11 different projects.I am giving all my .lib files into project settings->linker->input->additional dipendencies... But in my project settings->linker->command line i am not getting all the .lib files..i am missing three .lib files....Because of that reason i am getting 362 linking errors,all errors are due to not linking with the missing libraries... the errors are as follows..
fwfipd.lib(fwfpelcp.obj) : error LNK2001: unresolved external symbol "public: virtual class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > __thiscall DblTinyInt::getString(void)const " (?getString@DblTinyInt@@UBE?AV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@XZ)
......and many other errors.......
can anybody please give some remedy to my problem?thanks in advance.......
|
|
|
|
|
Vetukuri Raju wrote: can anybody please give some remedy to my problem?
Your linker cannot find the DblTinyInt::getString function. You need to find this library or source and add it to your project.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi actually my application is working in release mode...but not working in debug mode....i have several libraries...in debug mode three libraries are not getting linked...in my command line they are not shown...what to do
|
|
|
|
|
Vetukuri Raju wrote: Hi actually my application is working in release mode...but not working in debug mode
Yes, they have seperate build settings.
Vetukuri Raju wrote: ....i have several libraries...in debug mode three libraries are not getting linked...in my command line they are not shown...what to do
You don't know how to add libraries to your project settings? Are you using a Makefile or the graphical interface? Do you have your library paths setup correctly?
Another way to add link libraries is to add them to source files:
#pragma comment(lib, "Your_Library.lib")
Best Wishes,
-David Delaune
|
|
|
|
|
hi
i am setting my libraries from project settings->linker->input->additional dependencies...here i am putting my all libraries...
and where do i give full library paths?
|
|
|
|
|
Vetukuri Raju wrote: where do i give full library paths?
1.) You can add library paths for an single project solution to:
Project settings->General->Additional Library Directories
2.) If you want these libraries to be globally available to all projects you open in Visual Studio you can add them to:
Tools Menu ->Options->Projects and Solutions->VC++ Directories (choose Library files from combo)
I suspect that you need option 1.
Best Wishes,
-David Delaune
|
|
|
|