Hello! I am looking for a way to make a program in C or C++ that detects if there was any files altered, renamed, moved or deleted in a specified directory for Linux systems. Is there a way to do that?
...
I have a pointer and I want to check if the referenced memory is readable, writeable and/or executable. How can I do this?
...
Hi
I started to write a terminal text editor, something like the first text editors in unix like vi. The only purpose is have a good and fun time, but I want to let in show text in color, so I could use it for edit source code. How could achieve this? There some POSIX special API for this, or I have to used ncurses (i don't want use it)...
Hey
I have the following code parts:
typedef struct Board* BoardP;
typedef struct Board {
int _rows;
int _cols;
char *_board;
} Board;
char* static allocateBoard(BoardP boardP, int row, int col) {
boardP->_rows = row;
boardP->_cols = col;
boardP->_board = malloc(row * col * sizeof(char));
return boardP-...
I'm stuck at yet another C problem. How can I concatenate two strings with the second string being inserted before the first string?
This is what I came up with. Unfortunately I'm stuck at all these pointer to chars, char arrays et cetera.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[] )
{
...
Question of the century? I basically want to know which would be more efficient if I wrote this code as several different variables or if I used small arrays.
int x = 34;
int y = 28;
int z = 293;
vs
double coordinate[3] = {34, 28, 293};
I have a coordinate struct which I will use in the following way:
typedef struct coordinates_t ...
I've got very strange problem on my Windows XP in VirtualBox.
ReadFile() function refuses to read more than 16Mb of data in single call.
It returns error code 87 (ERROR_INVALID_ARGUMENT).
Looks like data length is limited to 24 bits.
Here is the example code allowed me to find out exact limit.
#include <conio.h>
#include <stdio.h>
#in...
It appears that some electronics have programmed within them what's called an "alarm subsystem". What exactly is this subsystem? what does it tie to? what does it do? Is it known by any other name? If I were to program one, in general what would be the pseudo logic of it? Please don't mind going heavy on the details as I'm really new to ...
Hello all. I am trying to add an int to a float. My code is:
int main() {
char paus[2];
int millit = 5085840;
float dmillit = .000005;
float dbuffer;
printf("(float)milit + dmillit: %f\n",(float)millit + dmillit);
dbuffer = (float)millit + dmillit;
printf("dbuffer: %f\n",dbuffer);
fgets(paus,2,stdin);
retu...
I purchased "A Book on C" for my procedural programming class and I was going through some of the exercises. Chapter 2 Exercise 9 is about designing a unit converter that can work with ounces, pounds, grams, and kilograms.
The code I've written works, but I really think it could be done much cleaner. Using nested if statements seems lik...
Intel Core2Duo, for example is supposed to have a single die but two cores.
So, it should be possible to control what is processed on which core, which means that it is possible to instruct my algorithm to use the two cores in parallel.
The question is how?
Do I need to go down at the kernel level to do this, or is there a simpler wa...
I am parsing the domain name out of a string by strchr() the last . (dot) and counting back until the dot before that (if any), then I know I have my domain.
This is a rather nasty piece code and I was wondering if anyone has a better way.
The possible strings I might get are:
domain.com
something.domain.com
some.some.domain.com
Yo...
I have the following problem: when I get a backtrace in C using the backtrace(3) function the symbols returned the name of the functions is easily determinable with the dwarf library and dladdr(3).
The problem is that if I have a simple function pointer (e.g. by passing it &function) the dladdr + dwarf functions can't help. It seems tha...
While programming I have come to an unusual error. When I initialize an integer in a loop, sometimes it says that the expression is not valid, but at times it accepts it.
This is my code which gives error:
int pow(int x,int n);
int main()
{
int x,n,result;
printf("Enter a number:\n");
scanf("%d",&x);
printf("Enter its po...
My application is a vector drawing application. It works with OpenGL. I will be modifying it to instead use the Cairo 2D graphics library. The issue is with zooming. With openGL camera and scale factor sort of work like this:
float scalediv = Current_Scene().camera.ScaleFactor / 2.0f;
float cameraX = GetCameraX();
float cameraY = Get...
int main(void)
{
int x = 10, y;
asm ("movl %1, %%eax;"
"movl %%eax, %0;"
:"=r"(y) /* y is output operand */
:"r"(x) /* x is input operand */
:"%eax"); /* %eax is clobbered register */
}
what is r(y) here also why %% is used before eax. generally single % is used right ?
...
hello,
is there is any good parser in c or c++ for extracting tags and links from html page ...
...
I've a temperature conversion program as an assignment, which I've completed. The program has many printf statements in it which print the temperature. Now the negative temperatures are printed the way I want them but the positive temperatures are printed without a leading + sign.
Now what is the best way to get printf print a leading ...
I know that C is the standard programming language for operating system development, but out of curiosity I was wondering what preceded it. What was the main programming language used for operating system development before C?
...
Given that I do something like this:
void glOrtho( GLdouble left,
GLdouble right,
GLdouble bottom,
GLdouble top,
GLdouble nearVal,
GLdouble farVal);
and the result is: http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xmlw could I achieve a matrix like this:
http://cairographics.org/manual...