I'm developing a Python module in C that parses a very efficient protocol which uses dynamic integer sizes. Integers sent using this protocol can range in size from the equivalent of C's 'short' to a 'long long.'
The protocol has a byte that specifies the type of variable being sent (from short to long long), but I'm not sure how to dea...
I am trying to setup allegro to work with visual stupid express 2008 but I can't find a set of instructions for the life of me. I just want to to recognize the allegro library. Is there anyone who is familuar with allegro who could possibly help me out cause all the tutorials do not cover installation process and their documentation is ...
I am following a tutorial and one of the steps its asking is to go to my projects properties and click on c/c++ and add a path to "Additional Include Directories" property. I am using visual C++ Express Edition 2008. the tutorial is using the same thing. Is there away to get this or an alternative ??
This is my screen
This is tutorial...
I got the error
from error.c:31:
/usr/include/ap/mas.h:254: error: expected specifier-qualifier-list before ‘time_t’
make: *** [error.o] Error 1
Feedback
We at least need to see line 31 of error.c and line 254 of mas.h, with preferably a few lines of context around each. This error may have nothing to do with how time_t is being d...
How do I read input one string at a time to call another function in C. I thought this would work, but my output hangs:
#define BUFFMT "%255"
#define LINE_LEN 256
#define START_COUNT 1
// filename is declared in the main file elsewhere. I know the file opens since I tried an //old method I use to read one line at time using fgets, bu...
I'm trying to create a singly linked list from an input text file for an assignment. I'm trying to do it a little bit at a time so I know my code is not complete. I tried creating the head pointer and just printing out its value and I can't even get that to work, but I'm not sure why. I included the struct, my create list, and print l...
i have write a code to retrieve network packets form Ethernet card in windows using ansi c help required?
...
Years ago I had a little #define which I used in Borland C++ Builder. From memory, it was something approximately like
#define BREAK_IF_DEBUGGING asm(0xA3);
or something like that. It relied on 0XA3 (or whatever it was) being the op code for the interrupt which Borland were using to trigger a breakpoint.
Can I do the same thing in...
I'm basically trying to create a linked list from a text file and add a new member every time the words are different, and increment the count if the words are the same (hw assignment). I thought I did it correctly, but it seems to add a member no matter what. I'm wondering if I'm traversing the list incorrectly while I search? Here i...
hi,
I am porting our application from solaris sparc to solaris x86 and I encountered a size differences of struct between these two architecture. for example;
I have a struct like
typedef struct mystructS
{
double a;
double b;
double c;
double d;
double e;
double f;
double g;
double h;
double aa;
double ab;
doubl...
Hi, i am very new to unix/linux/c which i guess is why i am in this predicament.
Anyway, i have just completed a c programme assignmnet and am trying to run it from linux terminal. So far i can create the main programme by
navigating to the folder
running gcc myFile.c
then doing .a/.out
this then runs my programme from the terminal wi...
I have a bash script in which i check the exit code of a last run command by using $? variable but now I am executing a C program (from that script) which returns 0 if the program gets executed successfully. Is there any way I can catch this return value of the C program from with in my bash script?
I believe different commands like awk...
I have following code(part of code):
snprintf(
command,
sizeof(command),
"%s -o %s -n \"%s\" -st %s -et %s -a \"%s\"",
_pcOPMTRExePath,
_pcTempFile,
l_acHostName,
_pcStartTime,
_pcEndTime,
l_acMessage
);
printf("%s",command);
l_iRetValue = system(command);
/* Return an error if failed to copy*/
if(l_i...
I have used unions earlier comfortably; today I was alarmed when I read this post and came to know that this code
union ARGB
{
uint32_t colour;
struct componentsTag
{
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a;
} components;
} pixel;
pixel.colour = 0xff040201;
/* ---- somewhere down the...
If I place atexit( fn ); on the exit stack, it will get executed when the program exits: returns from main() or via exit().
Can I remove it from the stack?
Why do I want to do this, you ask?
I was experimenting with a simple try-catch mechanism using atexit, setjmp and longjmp. It would be just perfect if I could undo-atexit(fn); - ev...
may I know the meaning or even how to read this:
srandom( time( NULL ) )?
...
Hi, I was wondering if someone could please help me with this:
printf("Enter path for mount drive (/mnt/Projects) \n");
scanf("%s", &cMountDrivePath);
Is it possible to allow the user to simply press Enter and accept the default (in this case: /mnt/Projects)?
At present, if the user presses Enter, the cursor simply goes to the nex...
How am I able to access a static variable from another file? Doesn't static variable have a file scope?
bash-3.2$ ls
a.c b.c
bash-3.2$ cat a.c
#include <stdio.h>
static int s = 100;
int fn()
{
/* some code */
}
bash-3.2$ cat b.c
#include <stdio.h>
#include "a.c"
extern int s;
int main()
{
printf("s = %d \n",s);
return 0;
}
bash-3....
How come ceil() rounds up an even floating with no fractional parts?
When I try to do this:
double x = 2.22;
x *= 100; //which becomes 222.00...
printf("%lf", ceil(x)); //prints 223.00... (?)
But when I change the value of 2.22 to 2.21
x *= 100; //which becomes 221.00...
printf("%lf", ceil(x)); //prints 221.00... as expec...
Hi all,
I am just wondering if there are any usefuls tools out there that allow me to exploit the Instruction-Level-Parallelism in some algorithms. More specifically, I have a subset of
algorithms from the multimedia domain and I wonder what is the best way to exploit ILP
in this algorithms. All this algorithms are implemented in C, so ...