You are using an automatic variable sent from VB call. That variable, and the string contente, will be destroyed after the function that create the thread returns. The thread instead will be running and looking for the string at the address that you passed in the thread creation, but that address holds only garbage by then...
To make it work create a local string in your code and define it 'static', copy the passed string there, then create the thread.
If you have to start more threads with different strings, I suggest to allocate dynamic memory for each string to make it local for that thread. The thread can release the memory when it doesn't need it anymore.
c in case a global time step is reqd. eg. time accurate problems
No, I mean what is the programming problem? Telling us what you want to do does not give enough information about where you are stuck or what you have tried. If you know the mathematics of the problem then converting that into C++ code should not be too difficult.
Once again you are expecting us to guess what is happening; we cannot see your screen or read your mind. Please edit your message, add <pre> tags around your code to make it readable, and explain exactly what the problem is and where it occurs.
I wanted to calculate outgoing flux on 2D circular grid. So first part of this code is for to get grid point after that i initializes variables on those grid points, now i want to calculate diagonal to get unit normal through it .
above code running upto global time step
Hey guys, I am kind of new with C++. I have an assignment to do which is similar to this one:
My problems are how to read I/O files and how to actually DO this program. I am really lost with it.
This is not my homework, as u can see this link is from 2007. That is why I posted instead of my homework. I need assistance, so I will be able to solve my homework. If you can post something/link that may help me I will appreciate. Otherwise thank you, but I do know about my responsibilities as a student.
I have a need for creating a class template and you may help me.
 Multiple coclasses will be implemented in a single dll.
 Each coclass will implement the same interfaces but will have different class/clsid/resid.
 It is necessary to create a class template taking clsid/resid as its template paramemters.
 Finally, I need to use template classes for CoCreateInstance.
The problem is that I need to create many coclasses now and in the future.
I don't want to copy/paste for all of them because it is quite hard to maintain the source code for all the copy/paste'd coclasses. It is quite error-prone.
So, I definitely would like to create a class template.
Below, I created a class template and it compiled ok.
class ATL_NO_VTABLE CComT
: public CComObjectRootEx,
, public CComCoClass, &CLSID_T>
, public IDispatchImpl
I'm trying to compile a c++ project on a raspberry pi using g++. I get the following compilation error:
PROCESS.CPP: In function ‘int process(int, char*, ControlData*, char*, char*)’:
PROCESS.CPP:172:49: error: ‘_fullpath’ was not declared in this scope
PROCESS.CPP:185:45: error: ‘_fullpath’ was not declared in this scope
The file PROCESS.CPP has the header
which I thought should contain this declaration. I have checked the header path using the g++ -H command and it gives /usr/include/stdlib.h so I presume it is finding the file.
I don't want to start fiddling with my own declarations within the scope as there are many other files to include in this project.
_fullpath is a Microsoft specific library function that does not exist on Unix systems. You may use the realpath[^] function instead.
Because pathes are different on Unix and MS operating systems, the function call can't be simply replaced. I assume that you are tyring to compile some source that has been originally written for a Microsoft OS. You have to analyse the code and rewrite it to get similar behaviour on your Pi.
The underscore is a clue because it is not used with Unix libraries (at least the common ones). To get the description for standard library functions on your Pi just type "man ". I was quite sure that fullpath does not exist and checked it this way.
I have one query. I want to get the Login and Logout Time of a user. I want to get the time when user login to a pc, lock the PC, Logout (shutdown) the PC. I want to keep track of the Login / logout / Locking time of the user. Is there any class or any code available in C++ / MFC.
I have one query again. this function gives the Last logon and Logoff time in the number of seconds that have elapsed since 00:00:00, January 1, 1970, GMT. How can I get the correct value in Time format.
Also I want to get the record of user logon and logoff time for each day. Should I use the same function.?
I have one query again. this function gives the Last logon and Logoff time
in the number of seconds that have elapsed since 00:00:00, January 1, 1970, GMT.
How can I get the correct value in Time format.
Converting time since that epoch was something I learned very early on in my career (some 25 years ago). It's worth the effort at figuring it out (without the help of Google).
Also I want to get the record of user logon and logoff time for each day.
Should I use the same function.?
Since the above is always referenced from a fixed point in time, you'd need to "capture" it once per day. Admittedly, there may be a log somewhere that Windows keeps where it writes an entry for every time a user logs in/out of a workstation. I've never had the need to know so I can't tell you if this is true or not.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
CMenu* pContextMenu = menu.GetSubMenu(1);
pContextMenu->InsertMenu(0, MF_STRING | MF_BYPOSITION, ID_LISTMENU_OPEN, _T("&Open"));
pContextMenu->InsertMenu(1, MF_SEPARATOR | MF_BYPOSITION, 0); // insert your menu at index 0 (first position)
pContextMenu->SetDefaultItem(0, TRUE); // put the inserted menu as default
ID_LISTMENU_OPEN must declared somewhere in your app, as UINT
So I have a thread, thread one, that writes a byte (an ACK) to a COM port (COM over USB), then sets an event, and a thread, thread two, that's waiting on that event with WaitForSingleObject, INFINITE, which then writes 7 bytes to the port, then goes back to waiting again. Thread one, then reads data from the port, and when its got the whole chunk, writes the ACK, sets the event, and so it goes round again. ad infinitum.
Now I have a USB analyser on the wire, so I can see the timing here, between the one byte ACK going out, and the 7 bytes of data, and it is sometimes 4 seconds!
4 seconds? One thread does a SetEvent, and the other thread, doing a WaitForSingleObject takes 4 seconds to get notified?
See, almost 4 seconds, that's the USB sniffer trace. What the hells going on?
Just seen one trace go by, and its 8 seconds!
I mean, cant MSFT tighten it up a bit? This is appaling!
( By the way, the driver is mine, and the time between the IRP_MJ_WRITES of 1 byte, and 7 bytes, also reflects the large gaps seen on the USB bus. The driver traces when its hit by the app calling WriteFile() so its not a problem in the driver either, it really is the thread scheduling. )
Last Visit: 31-Dec-99 19:00 Last Update: 5-Mar-15 20:46