I'm working on a library which implements the actor model on top of Grand Central Dispatch (specifically the C level API libdispatch). Basically a brief overview of my system is as such:
Communication happens between actors using messages
Multicast communication only (one actor to many actors)
Senders and receivers are decoupled from o...
Delete every 't'th (t>1) node of a single linked list. In the resultant linked list, again delete 't'th node. Repeat this till only t-1 nodes remains.
For this i have come up with:
Traverse until you reach 't'th node, delete all the nodes till the end.
Is there any efficient way other than this?. Can any one please help me out. Thanks.
...
I'm trying to generate textures like so:
#define checkImageWidth 64
#define checkImageHeight 64
static GLubyte checkImage[checkImageHeight][checkImageWidth][4];
static GLubyte otherImage[checkImageHeight][checkImageWidth][4];
static GLuint texName[2];
void makeCheckImages(void)
{
int i, j, c;
for (i = 0; i < checkImageHeight;...
I was reading that memcpy takes the number of bytes from a source location and adds it to a destination location. Does this mean that memcpy could possibly change datatype entirely ??
memcpy(DoubleOne, CharTwo, strlen(CharTwo));
considering that both values are empty still.
...
I'm playing with C and I've run into this error:
#include <stdio.h>
int main ()
{
char* foo;
scanf("%s", foo);
printf("entered %s", foo);
return 0;
}
scanf takes pointer, foo is pointer, yet I get bus error. How can I make it work?
...
I have to write a program in C which returns file size in blocks just like ls -s command.
Please help.
I tried using stat() function (st_blksize)...And I am unable to implement it.
My code looks like this
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
void main(int argc, char **argv)
{
DIR ...
Does C language support inheritence. If so is is it using structures as classes are not defined in C.
...
I have the following code snippet. This is a c file in visual studio 2010. If i try to compile this with the line: int hello = 10; commented out it will compile just fine. If I comment that line in it will not compile. Am I missing something or should I not be using Visual Studio 2010 to compile C code. If this is a Visual Studio pr...
GDI+ makes use of WCHAR instead of what the WinAPI allows which is CHAR. Usually I can do:
char *str = "C:/x.bmp";
but how do I do this for wchar? I can't juse do
wchar_t *file = "C:/x.bmp";
Thanks
...
I know I must be over-complicating this because it NSTimeInterval is just a double, but I just can't seem to get this done properly since I have had very little exposure to objective c. the scenario is as follows:
The data im pulling into the app contains two values, startTime and endTime, which are the epoch times in milliseconds. Th...
I resize my window like this:
RECT clientRect;
GetClientRect(mainWindow,&clientRect);
glShadeModel(GL_SMOOTH);
MoveWindow(framehWnd,
toolWidth,
tabHeight,
((clientRect.right - clientRect.left) - toolWidth) - rightRemainder ,
(clientRect.bottom - clientRect.top) - tabHeight - paramHeight,
...
Hey all,
So I've been playing around with pthreads, specifically trying to calculate the product of two matrices. My code is extremely messy because it was just supposed to be a quick little fun project for myself, but the thread theory I used was very similar to:
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#define M ...
how can i get the space taken by a pointer at run time
...
Hi
I wrote a code in Linux platform that read the data in serial port, my code below:
int fd;
char *rbuff=NULL;
struct termios new_opt, old_opt;
int ret;
fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY);
if( fd == -1 )
{
printf("Can't open file: %s\n", strerror(errno));
return -1;
}
tcgetattr(fd, &old_opt);
new_opt.c_cflag = B115200 |...
Hi,
I have been given a task at school to write a program that
Reads three strings
Stores the third string in dynamically allocated memory
Print out the last 4 letters of the first word alphabetically.
Here is the program I have so far. The strings are all stored in different variables, making them hard to sort. If anyone could give...
I am implementing a divide and conquer polynomial algorithm so i can bench it against an opencl implementation, but i can't seem to get malloc to work. When I run the program it allocates a bunch of stuff, checks some things, then sends the size/2 to the algorithm. Then when I hit the malloc line again it spits out this:
malloc.c:309...
I have an application running called AppFS. This application has an ext2 filesystem just attached to the end of the file (it's positioned so that the application binary exists in a 1MB spacing area, followed by the ext2 data).
Now I've got FUSE embedded in the program and I've managed to extract the filesystem out of the application da...
Hi ppl =)
I have following file: test_network.pcap: tcpdump capture file (little-endian) - version 2.4 (Ethernet, capture length 65535)
I know that in this file are few video streams and i need to extract them. How can i do this?
The biggest problem is that size of file ~180 GB ))
...
I know this question could be in vain, but it's just out of curiosity, and I'm still much a newb^^ Anyways I've been loving python for some time while learning it. My problem is obviously speed issues. I'd like to get into indie game creation, and for the short future, 2d and pygame will work.
But I'd eventually like to branch into the ...
Hi,
I am using Ubuntu and I want to read the version of its kernel. I found a file named version in /proc/ that records the version of the current kernel.
If I dont want to read file, is there any other way, like built-in function in C, that I can read the version in C?
Thanks
...