15,797,682 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Python questions
View PHP questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by zlogdan (Top 56 by date)
zlogdan
20-May-14 11:31am
View
OK, will this question.
zlogdan
20-May-14 10:25am
View
Apologizes, I only realized now that this phrase was no less than "undue". I was in a hurry, will try to describe better later.
zlogdan
20-May-14 10:24am
View
Apologizes, I was in a hurry when I posted this. Will later post the whole thing.
zlogdan
5-Jul-13 19:01pm
View
It was not said that was the case of friendship in this present post. I was merely mentioning why posts like these should not be answered. I usually help people with their homework if they can elaborate an initial draft or something they are trying to do for them selves instead of posting something here and simply saying : hey do my homework please I need it fast! One of the main reasons for the forum is to make the solution available for other users that can benefit from the information. Should the OP have written his/her own code which was causing troubles, it would be definitely worth trying to elaborate a directive to the OP so his/her issue could be solved. Edit: I definitely had not seen your code before but it is incorrect. I suspect you are either a troll or were not aware of what you were doing.
zlogdan
5-Jul-13 8:40am
View
Posting such questions leads to people being awarded for doing the job someone else should have done, either for learning or for profit. I suspect some people make simple questions to "friends" to easily answer them. Just like, hey "what is int i = 0; ?" I downvoted your solution as well.
zlogdan
5-Jul-13 8:37am
View
5 stars!
zlogdan
4-Jul-13 2:16am
View
Agreed! My 5 stars answer.
zlogdan
3-Jul-13 10:45am
View
by the way, in modern C++, since 1998, it is <iostream> not <iostream.h>. Either your tutorial or book are outdated.
zlogdan
3-Jul-13 10:43am
View
5 stars solution!
zlogdan
2-Jul-13 15:38pm
View
5 stars.
zlogdan
2-Jul-13 15:35pm
View
I bet the OP took Java classes and now someone is asking her to convert her previous code to C++.
zlogdan
2-Jul-13 15:34pm
View
She may be converting it to managed C++. This is kind of an indication virtual String ^nextToken();, why use managed C++ if you can write C# apps ? In either cases, it seems the Op wanted everything to be made by magic by the converter and fortunately and thank God for us C++ programmers it is nearly impossible.
zlogdan
2-Jul-13 8:32am
View
http://www.functionx.com/visualc/index.htm
zlogdan
1-Jul-13 13:46pm
View
Check this serial port emulator http://com0com.sourceforge.net/. I used it a lot for simulating serial ports. You will probably need a sniffer. Modbus protocol is pretty straight forward to implement these days, specially if you only need to handle two end points communications. The above link given by Phantom is the canonical article for the serial port communication software design at windows.
zlogdan
1-Jul-13 13:39pm
View
Have you tried to allocate more than 4K bytes for the buffer ? Are you supposed to receive the number of bytes read at length or you are supposed to inform its size, in either cases please initiate the variable before trying to call the readData method. Also, does this method return anything or it is a void return method ? Perhaps the return value will indicate you what is wrong.
zlogdan
27-Jun-13 13:30pm
View
My canonical sites list for MFC are http://www.functionx.com and MSDN. If they fail, well, I search here. Function X MFC tutorial is by far the most complete I am aware of.
zlogdan
27-Jun-13 13:01pm
View
5 stars answer.
zlogdan
27-Jun-13 11:27am
View
Please post more relevant code here, what happens if you initiate IStreamBufferSink with a value different from NULL ? Does your code to execute it is within a try catch statement ?Also, have you tried to allocate this object statically ? What compiler are you using ?
zlogdan
24-Jun-13 13:56pm
View
Thanks a lot!
zlogdan
24-Jun-13 13:15pm
View
@nv3, you were right. It was nothing thread related. Please see my update above. Also, please post a solution below, because IMO you have given me the solution to the issue and I would like to give the credit for it.
zlogdan
24-Jun-13 13:12pm
View
@H.Brydon It was something simpler, but a sum of issues, please see my update above.
zlogdan
24-Jun-13 13:11pm
View
@JackDingler it ended up being a sum of issues, please see my update at the question.
zlogdan
24-Jun-13 9:46am
View
@nv3, I apologize for the misconceptions. I am not really happy. I think my test project kind of deviated me from the problem. I did not know about the floating point exceptions tip, I apologize again. I was digging around the whole directory and found out a small project that tests this Logging class, that is much more realistic than my test code. I apologize again. I am going to try the test project someone left it here. I think I should have dug this project directory better. Sorry for the lack of accuracy. And thanks a lot for the help.
zlogdan
24-Jun-13 9:00am
View
Yeah, I debugged it locally with my simple test code. The program halts at the division by zero code and the exception is not caught, I actually removed everything and just left the division by zero code. The actual Logging class is quite big, and I bet there is something on it that was improperly implemented...
zlogdan
24-Jun-13 8:56am
View
I comment everything and just left the division by zero code, and the exception is caught but it causes the program to halt. I cannot locally access the event log on my local machine, the real system displays a generic error.
zlogdan
22-Jun-13 10:25am
View
I had tried a simple test app, and I am sure that this Log class is ok and an exception is being raised and it makes the service to crash...
zlogdan
22-Jun-13 10:24am
View
In fact I was so worried about the outputs and used to not being able to debug that I forgot that I can debug this at my workstation. I will try it this Monday at work, it crashes right at this line: _d->DummySimple(); So I am thinking, like you folks told me to focus at this, that the Log class is ok, and some exception is being raised making the service to crash.
zlogdan
21-Jun-13 19:47pm
View
@JackDingler, I am going to do this! Thanks!
zlogdan
21-Jun-13 15:54pm
View
(1) I think this might be the case. But how would it work if compiled on VS 2003 and not at VS 2010 ? I have been given this question many times, my answer is: VS 2003 permits lots of unsafe code and make it easier to bugs to arise but I am really kind of desperate now.:-)
zlogdan
21-Jun-13 15:51pm
View
This logging class is quite complex and has lots of dependencies. I tried to isolate just the basic part of it but did not get good results. The original code runs on a windows service which is also a web server, that access a database and receives data from ISAPIs and web services. To be quite honest I am far from an expert on this system, just trying to make it work on Windows 2008 Server. It was compiled under VS 2003 and run on Windows 2000 server, but after recompiling it on VS 2010 and trying to run it, it simply does not work. Due to my complete ignorance on programming windows services I may be missing the point where to initialize the class. But as I said, this code used to work on an old server and compiled with 2003.
zlogdan
21-Jun-13 15:25pm
View
I have liked every Microsoft compiler: VS 6, 2005-2012, and all problems I had with them were also due to my own errors :-) Except 2002/2003. I have posted an update for the question.
zlogdan
21-Jun-13 10:55am
View
Thanks, I am without web access while at work. Only at lunch time... I am going to check all possible solutions indicated. I did not write the return (log) thing, but yeah I should have removed it.
zlogdan
20-Jun-13 19:46pm
View
It did not work, but I have only tested trying to call the class during service initialization.
zlogdan
20-Jun-13 19:45pm
View
@nv3. It does not return a NULL pointer. The service is halted after that. I will check the hypothesis of AtualizarRegistro (update register ) throwing an exception. Is it me, or do you all also loathe visual c++ 7 compiler ? I am thinking that you and JackDingler might be both right.
zlogdan
20-Jun-13 16:06pm
View
Sorry, I had edited the code to post here, changed logAlerta to log ( Alerta == Warning in Portuguese )you are correct, going to fix it!
zlogdan
20-Jun-13 15:42pm
View
Thanks, I have just made the call during the service initialization then will use! I am still waiting the system engineer to test it :-/
zlogdan
20-Jun-13 15:16pm
View
I will try to check this possibility. I have already tried to call it for the first time in the log.cpp file and also during the main function of the service. I am going to try your suggestion! THANKS! Edit: I was compiling 4 projects at once and all of them include the log class. And I had forgot to call the class within the ISAPI calls. 3 DLLs and one windows service. I am going to test it! But looks you nailed it!
zlogdan
17-Jun-13 14:09pm
View
I bet you already did it, but it is worth asking: have you checked calling conventions on your project that imports the DLL? Also, have you used a .def exporting file or the __QOR_INTERFACE( __ARCHQOR ) macro calls the exporting __dllexport__dllimport macros ?
zlogdan
17-Jun-13 11:39am
View
@H.Brydon. I completely agree with everything you said, that is my desired approach. But please bear in mind that down here in Brazil one is always easy to meet a boss or co-workers with high status that yours that are unwilling to accept they are outdated. After being terribly bashed for stimulating them to take modern approachs, I have had always got replies like "Why are you upgrading the compiler? Why you are changing this line ?". In the end I gave up. Still, I update every non-compliant I find, removing the warnings even. But at this present time I was not aware of what the developers meant. My experience always tells me to don't argue with the moto "They did it before, it worked, they cannot be wrong". It is strange that at my previous work we had to port our code to Linux and once lots of innacuricies were pointed by the compiler output I had to just say "this gcc compiler is crazy" instead of "what would you expect from converting from a real lame compiler to a decent one"? I had a coworker who did not know what a class was exactly, he just worked his way out copying code from the web. He was older than I at the job, and he knew the product quite well. Everytime I told him I was upgrading the code to better compiler he said "Why? This new compiler is bad! Use VS 2003". I know I should have consistently told him he was wrong, but I lowered my head. Stubborn folks are never convinced to be wrong.
zlogdan
17-Jun-13 9:00am
View
Many thanks H.Brydon. I am updating the system (from lame VS 2003 ) to VS 2010. So I am daily puzzled with things that seem quite weird under comparison to C++ standards. I must admit that I have never used this kind of protection in my own code, I just have read it in books/tutorials. My original question was why someone was trying to use the code I posted, instead of doing it properly as you did above. And in the code, they ( people that wrote the code before ) wrote initialization like: const XMLLegadoResponse &xmlResponse(servidorLegado.ListaAssinantesHSM(documento,pessoaJuridicaHsm)); Where ListaAssinantesHSM returns a const reference to a XMLLegadoResponse object. I also had seen the usage of the assignment operator like in
const XMLLegadoResponse& xmlResponse = servidorLegado.ListaAssinantesHSM(documento, pessoaJuridicaHsm); First, I try to change the least possible in legated code, because If it does not work, they usually blame me :-) Always hear "so-called experts" saying "why are trying to convert it to a newer compiler?" and usually I have seen that VS 2003 is a quite permissive compiler in terms of absurdity and lack of compliance and usually my bosses hardly know what an ISO standard is. I had one boss that told me he, 3 years ago, he was against things that were not really C++ like "std::vector or std::string". Second, I read my C++ books several times and I was not sure what they original coders wanted. I thought it was something simple and I was missing the point.
@nv3 If you don't mind I would like to change the accepted H.Brydon's solution instead, let me know if you are ok to it.
zlogdan
13-Jun-13 16:59pm
View
Although the DLL mechanism permits that we export C++ classes, I personally prefer to export ANSI C functions, although most of the DLL internals I write in C++. Not sure if this will fix your compilation problems though.
zlogdan
13-Jun-13 11:42am
View
My 5, excellent! Congrats! If possible, please expand this to an article!
zlogdan
12-Jun-13 12:15pm
View
One also benefits from using structs while passing arguments to a function. My 5. Virtual 5 to nv3 too.
zlogdan
12-Jun-13 11:29am
View
Not a big fan of make files my self, had to cope with them until we started using Qt. I voted five for this, excellent tutorial.
zlogdan
11-Jun-13 8:54am
View
Thank you all!
zlogdan
10-Jun-13 17:14pm
View
@nv3 , Thanks! I understood you well, just want to make something else clear. You said that it is not possible to instantiate an object if the copy constructor is not accessible, thus in the above cases ( as the copy constructor is made private) there is an implementation error, right ? The compiler should have raised an error ? I am actually facing a trouble at this part of the code someone else wrote like 8 years ago. Still polishing operator overloading skills. Thanks!
zlogdan
10-Jun-13 11:28am
View
Understood :-)
zlogdan
10-Jun-13 10:28am
View
I voted 5 for this, but I am sure you meant printf instead of fprintf, didn't you ? Anyway, it is always a good idea to create logs for your apps while they are being developed.
zlogdan
5-Jun-13 9:48am
View
Please take a look here http://www.cplusplus.com/reference/string/. You only have to call it, it is already included in your project ( string header , namespace std )
zlogdan
5-Jun-13 8:24am
View
No, for example, your code might be generating values like 0x04, 0x05. And if you try to output these chars they won't have any readable ascii representation. So, you need to convert it to a C string like "0405" or convert every item of the array separately and display them. If you try a cout << with a binary buffer say { 0x04, 0x05 } you will get those weird chars.
zlogdan
4-Jun-13 9:57am
View
Richard nailed it man! Also thanks for the link!
zlogdan
4-Jun-13 9:56am
View
Don't use the same buffer for your conversion and input, better allocate memory for the result and returning it from a class method like char* getResult() const; Also, I would check the buffers using and hex editor like HxD. Please post the strings you are getting here, I am just guessing you need to convert your output data from binary to ASCII so the puts C function works fine.
zlogdan
31-May-13 10:18am
View
Thanks! I have already briefly worked with C# with smard card readers ( PCSC ). These were fast. I am mostly worried with performance, with applications that interface things like motors I would definitely use C++. I actually installed the .NET framework at my home pc, plan to study more of C#. I once read that once you learn C# you will just want to stay away from java :-)
zlogdan
31-May-13 8:49am
View
Yeah, but be aware that Visual Studio 2003 C++ compiler accepts the double inclusion. It was a bug in the original project, and I only could solve it because the second source code that imported the DLL is no longer used...
zlogdan
28-May-13 13:49pm
View
I have had to marshal C code into C# in the past, it was not easy, but I left this question at this forum and it helped me: http://stackoverflow.com/questions/3264789/how-to-convert-a-void-to-a-type-that-can-be-used-in-c-interoperability-betwee
zlogdan
28-May-13 13:41pm
View
The above was my 5 stars answer. Embedded systems/firmware, low level DLLs, device drivers, real time software they all benefit from being written in C/C++. From my own experience, Qt libraries are great wrappers for Windows and Linux APIs that deal with OS related functions and offer a real deal of features like XML or database. Sometimes, I prefer to use raw calls to WIN32 functions and wrapping them on C++ classes. I also like to create DLLs and export C functions rather than classes, but within the project I make use of C++. But if you asked me to start a new project from scratch, and if it required complex GUI programming I would use Qt instead of MFC. As for C# standalone applications, I may not have the expertise to tell, but my experiences with C# have been good, not sure how much the system performance is slowed down for real time software ( e.g, interfacing with external hardware, like smart card readers, fiscal printers, and other hardware ). But usually it seems everybody is using C# rather than C++ here in Brazil, which makes C++ programmers rare items and C# jobs more often found. By consequence, the number of C# programmers is huge, which makes the offer of programmers higher and shorter salaries. My current feeling is to think programming will not be a good working area in a near future in Brazil, although it is all I know.
Show More