struct file_operations scull_fops = {
.owner = THIS_MODULE,
.llseek = scull_llseek,
.read = scull_read,
.write = scull_write,
.ioctl = scull_ioctl,
.open = scull_open,
.release = scull_release,
};
This declaration uses the standard C
tagged structure initialization
syntax.
Can someone elaborate?
...
I've seen a few function definitions like this recently while playing with GNU Bison:
static VALUE
ripper_pos(self)
VALUE self;
{
//code here
}
Why is the type of self outside of the parenthesis? Is this valid C?
...
I'm working on a project and I need to create an API. I am using sockets to communicate between the server (my application) and the clients (the other applications using my API).
This project is in c not C++
I come from a linux background and this is my first project using Windows, Visual Studio 2008, and dll libraries.
I have com...
how the stack would look like for the following program if I give input as 5.
#include <stdio.h>
int fibonacci(int number)
{
int retval;
if (0 == number){
return 0;
}
if (1 == number){
return 1;
}
return(fibonacci(number-1) + fibonacci(number-2));
}
int main()
{
int number = 0;
int fibvalue = 1;
while (1){
...
How could I call a function from a DLL ?
I tried to declare a void pointer and to store in it the result of GetProcAddress... but didn't work. I also wanted to declare an unsigned long int ( I saw it somewhere on the internet ), but then I didn't know how to continue on. :D
So, would anybody mind giving me a hand ?
...
If I have a straight line that mesures from 0 to 1, then I have colorA(255,0,0) at 0 on the line, then at 0.3 I have colorB(20,160,0) then at 1 on the line I have colorC(0,0,0). How could I find the color at 0.7?
Thanks
...
I have installed Android NDK and want to make eclipse highlight c-source. How ?
...
does anyone know of a visual programming tool that could be adapted for children (kids age 7-12) so that they can generate c programs to control device?
...
i am using a pointer to an array of 4 integers as int(*ptr)[4]
using the following code in which m pointing to a 2-D array using this pointer
int arr[3][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12}};
int (*ptr)[4]= arr[4];
int m= (*ptr)[2];
what will be the value in "m"...
i need to find the value of element arr[1][2] how can i get it usi...
Hi,
I can inprove this function under CUDA?
What this function does is:
Given a min and max, ELM1 and ELM, check if any three numbers of array ans[6] are found in any row, from min to max, in array D1,D2,D3,D4,D5,D6, if found return 1
I tried any other way, like looping, or-ing, and-ing, replacing goto with flag etc. etc. but this se...
Hi everyone,
First off, I know that similar questions have been asked, but the answers provided haven't been very helpful so far (they all recommend one of the following options).
I have a user application that needs to determine if a particular process is running. Here's what I know about the process:
The name
The user (root)
It sh...
I reference this file "kbdext.c" and its headerfile listed on http://www.docdroppers.org/wiki/index.php?title=Writing_Keyloggers (the listings are at the bottom).
I've been trying to compile this into a dll for use in Python or Visual Basic, but have not succeeded. I'm not familiar with C or GCC to sort out the problems or do the dll co...
I'm looking for an efficient C or C++ algorithm that can convert RGB to HSV and vice versa. Thanks
...
There are two obvious ways in C to provide outside access to internal attribute values (A) provide a generic interface that accepts a list of attributes that changes over time (some added / some die) or (B) a specific interface for each and every attribute.
Example A:
int x_get_attribute_value(ATT att)
{
if (a) return a_val;
if...
Is there significant cpu/memory overhead associated with using automatic arrays with g++/Intel on 64-bit x86 linux platform?
int function(int N) {
double array[N];
overhead compared to allocating array before hand (assuming function is called multiple times)
overhead compared to using new
overhead compared to using malloc
The r...
This should be super simple, but I'm not sure why the compiler is complaining here.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int *n = 5;
printf ("n: %d", *n);
exit(0);
}
Getting the following complaints:
foo.c: In function ‘main’:
foo.c:6:
warning: initialization makes pointer
from i...
I got the book "Programming Role Playing Games with DirectX 2nd edition" and I notice there are things in the book that are now considered deprecated. There is a whole Section on DirectPlay. And as much as I would like to avoid this section, I am afraid it might screw up the entire engine he is trying to build.
So I was just curious to ...
I can't figure out what to do to make this work. Here's my code:
char* testStr = " trim this ";
char** pTestStr = &testStr;
trim(pTestStr);
int trim(char** pStr)
{
char* str = *pStr;
while(isspace(*str)) {
(*pStr)++;
str++;
}
if(*str == 0) {
return 0;
}
char *end = str + strlen(str) - 1;
while(end > s...
I am working on a robot, it's part of the summer robotics workshop in our college. We are using C-STAMP micro controllers by A-WIT. I was able to make it move, turn left, turn right, move backward. I have even managed to make it go along the black tape using a contrast sensor.
I send the robot at 30-45 degrees toward the black tape on ...
Hello.
In simplistic terms, a feature structure is an unordered list of attribute-value pairs.
[number:sg, person:3 | _ ],
which can be embedded:
[cat:np, agr:[number:sg, person:3 | _ ] | _ ],
can subindex stuff and share the value
[number:[1], person:3 | _ ],
where [1] is another feature structure (that is, it allows reentranc...