An earlier question explained that on x86 the size of objects being watched is limited by debug registers. As expected, I can “watch” a double variable. But I can’t watch a double datamember, for example, produces But when you try to continue execution, it says Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. even though
Tag: c++
how to interpret a freetype glyph outline when the first point on the contour is off curve
I’m actually working on a renderer that converts freetype glyphs into polylines to control a laser marking system. The problem I have is that I don’t know how to handle correctly a contour beginning with an off curve point (99.9% begin with on curve points!). I’ve searched quite a while now for informations but I couldn’t find anything useful. Thanks
How I can get ports associated to the application that opened them?
I need to get a list of all opened ports on my machine and what application opened them. I need to get this information programmatically. Thanks. Answer I was hoping a cleverer answer would appear. I did just this (programmatically in Python), in an attempt to rewrite a program called NetHogs. My version is here, specifically here is the module
how to read output of system(‘ls’)?
I am doing some file IO with c code. I have a particular pattern in my file. I can verify this by a shell command cat abc.txt | grep abc | wc -l. When I execute the same command using System(), it give proper output, but I have no clue how can I get its output into a variable and
How to change Keyboard Layout (a X11 API solution)
I want to change keyboard layout in Linux by programming, What X11’s API function does this? Answer I found one good solution. It’s a c++ class wrriten by Jay Bromley, that I can add to my app and using it. source code It’s very easy to use: you can read source code and found some another useful functions. for compiling
C write() doesn’t send data until close(fd) is called
So I have this test code to send “HELLO” over a USB serial port: The program executes fine and “HELLO” is sent but there is one problem. “HELLO” doesn’t seem to be sent when the write() function is called, but rather when the file descriptor is closed. I added the sleep(5) line above to test out this theory and sure
How can I convert a file pointer ( FILE* fp ) to a file descriptor (int fd)?
I have a FILE *, returned by a call to fopen(). I need to get a file descriptor from it, to make calls like fsync(fd) on it. What’s the function to get a file descriptor from a file pointer? Answer The proper function is int fileno(FILE *stream). It can be found in <stdio.h>, and is a POSIX standard but not
Linux, timerfd accuracy
I have a system that needs at least 10 mseconds of accuracy for timers. I went for timerfd as it suits me perfectly, but found that even for times up to 15 milliseconds it is not accurate at all, either that or I don’t understand how it works. The times I have measured were up to 21 mseconds on a
Uptime under linux in C
How can I retrieve uptime under linux using C? (without using popen and/or /proc) Thanks Answer Via top or via uptime, but I don’t know about any syscall, someone will for sure 🙂 uptime should be rather easy to parse. Just stumbled into this:
Why does setupterm terminate the program?
This is sample program from “Beginning Linux Programming” book: #include <stdio.h> #include <term.h> #include <curses.h> #include <stdlib.h> int main() { setupterm(“unlisted”, fileno(stdout), (int *)0); printf(“Done.n”); exit(0); } Running it, I have this result: ./badterm ‘unlisted’: unknown terminal type. According to setupterm function definition, it must return 0: “No matching entry in terminfo database”. Instead of this, program terminates. Why? Answer