I have a project that has a few .asm files (assembly language code), I have the compiler/assembler set to create a list file for the assembly code and would like the debugger to use the .lst file for the source instead of the .asm files because in the .asm files the macros are not expanded like they are in the .lst files which makes debugging difficult sometimes.
I used a heap viewer to check for memory leaks. I have many of them and its hard to find out where it is not being freed. Is their a way to use the debugger to log the addresses of the data it allocated on the heap. This way I can trace it back. Or is their any other way to fix memory leaks properly.
I have an interesting (and incredibly frustrating) problem where my application runs fine, but ONLY when a debugger is attached to it.
I can build in both Debug or Release and double clicking the execuable causes it to crash before the window is drawn. However if I launch from the IDE (VS2010), again in both Debug or Release mode, the application runs perfectly fine.
How to debug in this situation.
I am using VS2010 in Windows 7, C++ with MFC. This is an application which has been migrated from VC++ 6 to VS2010. Note, it works perfectly when built from VC++ 6.
And it compiles fine and, supposedly, works fine too, but when I try to put a break point inside the MakeTexture fuction gdb just goes crazy, it freezes and starts alocating memory until it reaches like 30+ mbs, and after that codeblocks freezes and I have to terminate the gdb process to return everything back to normal.
Now, another weird thing is that this only happens if I pass (char*)ilGetData(), if I pass something like NULL to the function, this doesn't happen.
i was trying to write a program in c language which can detect mouse movement, but the program which i have written can only detect the mouse click or scroll the program which i have written given below..
Code:
#include<stdio.h> #include<string.h> #include <ncurses.h> int main() { }
[code]....
run the programme with linked-lncurses. improve my program which also detect when the mouse moves.
I am using scientific linux. In the directory user/project/Build, after I ran 'make' to compile and link all the cpp files,I had no problems. But then, when I went to directory user/run/run.sh, which runs the project binary in user/project/Build/bin/project, I get a segmentation fault error. In the directory user/run, I enter 'gdb' in the command prompt and get the message "*** No targets specified and no makefile found. Stop." What am I supposed to do to detect the segmentation fault?
How would I detect if any letter key is pressed. Would I have to use GetAsyncKeyState() for every letter key? Or could I have some kind of loop going through all the hexadecimal values for every letter? I don't know how I would go through hexadecimal values with a loop.
i build an application, that makes the used memory growing. i don't get any error(unless, i believe, that i use some memory value(i don't know the value), but i see the memory growing very slowly. how can i detect the memory leak?
So I need to write a function that has 2 arguments that are strings. It returns 1 if the first string is a subsequence of the second string, and 0 otherwise.
For example, given 2 strings like "foobar" and "obr", the function should returns 1 whereas "foobar" and "obo" returns 0.I have tried writing the code myself,
Code: int sub(char *s, char *t) { int i; char *p; for (i=0; t[i] != ''; i++) { p=strchr(s,t[i]); if (p==NULL) return 0; else strcpy(s,p); } return 1; }
So my strategy is as follows: 1. Find the first letter of the second string in the first string (foobar). 2. If there's a match then continue to search for the second letter of the second string starting from the index of the first letter plus 1. (obar). Otherwise return 0,.........
However the function always return 1 no matter what the input strings are.
I have an application in c# that i don't want it to connect to the internet in a virtual environment, like virtualbox, vmware virtual pc and so on. Therefore i though that disabling the virtual network card inside the virtual machine would be a good idea.
I don't use Visual Studio and/or C++ so I would like to do it without them. I found this article c++ - How to determine CPU and memory consumption from inside a process? - Stack Overflow
I tried some lines of code but no one works for me.
So, I've been working on a project recently, and the only thing remaining to do is a detector to whenever down arrow key is pressed. The down arrow key can only trigger when a certain check box is checked and this will have to work with a timer either. The problem is that how to make the down arrow key press detector(I've got the check box and timer ready tho).
I'm trying to implement this on ubuntu, to compile and run only under ubuntu.
I found 100s of other attempts at answering the general question of arrow key press in c++. Nothing solid.
Some recommend using the Readline for the functionality I am trying to implement, but I need to stay clear of GNU licences if I can for this project. And some tips only work on projects for windows machines... for example the conio library.
For linux there may be the option of using the ncurses library which I will take a look at, but I am stubborn and want to implement this myself. It should be an easy straight forward thing to do, which is why I am a bit frustrated at the moment.
So! This works... 80% of the problem is solved. If you compile this, g++ under linux, ubuntu in my case, and run. Each keystroke reveals the correct key numbers.
q=113 w=119
when I click on the up key I get,
up = 279165
I thought, I can use this number is a if(int == '279165') to detect the up key.
I was not so lucky... this int is not behaving like an int!
So I modified the code to see it I could carry out an int operation on this number.
Compiling and running this, and pressing the UP key gives the following number.
100027100091100065
Some some sort of array, something like, [27][91][65].
I tried all ways to access these individual numbers, actually the third one for comparison purposes, but no luck.
For completeness sake I list the other arrows.
UP = [27][91][65] DOWN = [27][91][66] LEFT = [27][91][68] RIGHT = [27][91][67]
A little further digging shows that these numbers are derived from the representation of a "multi-char" constant, the data type given when pressing special characters...
Now here is the main problem I have, I can find ANY decent documentation on how to handle and play with "multi-char" .
I am trying to have a program that I am writing detect a controller and then say whether there is or is not one connected. But I am getting a lot of errors(25 actually) . Here is my code:
I made this (found the trick on the net)that allow to use the guide button of a 360 pad. I use wxdevc++.
#include <windows.h> #include <stdio.h> static const int guide_button_value = 0x0400; /* the secret function outputs a different struct than the official GetState. */ typedef struct { unsigned long eventCount;
[Code] .....
But I wanted to detect if it's held down for 3 second before do my printf
The usual solution is to detect if the button is pressed and if it's realeased but I can't use ximputgetstate or regular getstate (or I haven't successfully done it) .
I am trying to compile the files file1.c and file2.c using Mingw (gcc)
///////////////////// header.h //////////////////// #ifndef header #define header int variable; #endif
[Code] ....
I would have expected a multiple defnition error when linking the two .c files. as in both the files, with the 'int variable' command, the variable 'variable' is defined (memory allocated) and during linking the linker doesnot know which variable to link to.
I get an error though when i use "int variable =123;" in the header file instead of the "int variable;" statement. i dont understand as in both the cases the variable is defined (memory is allocated) and the linker should give a multiple definition error.
I have a problem with UDP Multicast. I managed to send UDP Multicast telegrams and receive them. But when I receive the telegram I need to find out to which multicast group address it was sent. So far I have:
When I read from.sin_addr.S_un.S_addr; then I get the original IP Adresse from the sender PC but I also would like to know to which group address it was sent. Is there a way to get this infoamtion?
(OS Windows)how do i detect when a file has been changed ? do i need to monitor this file and check the last modified date&time? (how do i do this?) furthermore how do i detect a certain application launch?