Hi everybody,
I have a question. In java I have a class which has global variables. Also, in this class I have an actionPerformed method implemented, which is called every time some event happens. Now, in actionPerformed , I set these variables. Although inside actionPerformed their values do appear to change, after it is finished, the values go back to their old ones. Why is this happening? How do I get the values to stay? Please help..
User Profile
Collapse
-
Java actionPerformed and global variables
-
System call error
Hey guys. I am trying to implement a system call in linux kernel. I usually use ubutntu, but this I am doing on Fedora. I am using kernel 2.6. Here is what I did:
1. Added a line to arch/i386/kernel/syscall_table.S :
.long sys_foo
2. Added a line to linux/include/asm-i386/unistd.h:
#define __NR_foo 324
also incremented the call count by 1.
3. Added this code... -
I mean unix style file integer descriptors ( i am writing this in linux). -
Checking if a file descriptor is valid
Does anybody know how to check if the file descriptor is valid? -
When I move the function to the same file it compiles fine. Is there a way I can keep this function in a .h file?Leave a comment:
-
Templates Error
Hey guys,
Here is what I am doing:
Code:
Code:template <typename T> void func(vector<T> vec) { .. .. .. }
-
STL vector core dump
Hey everybody. I have an issue where pushing a new item onto an STL vector, I get a core dump. Now, the capacity of the vector is not exceeded (its only 3). The vector contains integers. Now, in my application, I push stuff to the vector and works fine until that one point. Basically, I do this:
Code:vector<int> vec; vec.push_back(newInt);
-
C++ Debug Messages
Hi everybody. I was wondering if there is a way in C++ to have debug messages, and the ability to turn them off. For example, lets say I would like my program to have two modes. One mode is the mode where all the debug messages are printed, and another where they are not. Is it possible to do through the compiler? Ie to choose whether to compile the program with the debug info? I looked some stuff on google, and found some strange way in Visual... -
STL vectors and delete
Hey everybody. I understand that erasing elements in the vector invalidates the iterators. If you consider the following code:
Code:#include <iostream> #include <vector> using namespace std; int main() { vector<int> vec, vec2; vec.push_back(1); vec.push_back(2); vec.push_back(3); vec.push_back(4); vector<int>::iterator
-
-
Strange problems with string class
Hey Guys. This is a weird one. Basically what I am doing is reading a string from the file using getline(file, buffer) where buffer is a C++ string. For example: lets say the file contains the string "hello" without the quotes on one line. After I read the file and print out the buffer it says "hello" (cout << buffer) like it should..BUT when I do this:
buffer == "hello" , the answer is false.... -
STL set of Classes
Hey Everybody. Does anybody know which operators need to be implemented in order to make the stl set of those objects works? For example I have a class myclass, and I want to have set<myclass> myclass_set where I can insert objects into the myclass_set. Any idea is cool. -
-
Memory Usage From C++ Program in Linux
Hey guys,
Do any of you happen to know of a way to monitor the memory usage of your program from within your program? Any help would be great. -
Class templates strange problems
Hey Everybody. I have a question. I have a code like this in my .cpp file of the class:
template <typename T>
int myClass<T>::get Number()
{
return 1;
}
In my .h file I have everything set up correctly for the template class. However, when I compile it I get this error:
myClass.cpp: error: no âint myClass<T>::get Number()â member function declared in class... -
Linux Kernel Programming Book
Hey Everybody,
Could anybody suggest a good linux kernel programming book? The best kind would be like one those where you can learn a lot fast (like those 24 hour series books). Please let me know if you know any good ones.
Thanks -
-
It looks something like this:
ostream& operator << (ostream& ostr, user_state& var){
if(var.getthatf lag()){
ostr << "1";
} else {
ostr << "0";
}
return ostr;
}Leave a comment:
-
-
Weird thing with push_back again..
Hey everybody,
I have a situation where I have class, one of the elements of the class is a boolean. I also have a vector of that class type. Here is what i do:
vector<myclass> myv;
myclass m1 (initialize the class with the variable set to true)
myclass m2 (initialize the class)
myv.push_back(m 1);
cout << myv[0] << endl;
this prints correctly, and...
No activity results to display
Show More
Leave a comment: