How can I remove these warnings?
char foo[10], msg2[100];
int k;
for (k = 0; foo[k] != NULL; k++) //comparison between pointer and integer
msg2[k] = NULL; //assignment makes integer from pointer without a cast
Thanks.
...
How to implement a buffer of the packets where each packet is of the form:
typedef struct{
int32 IP; //4-byte IP-address
int16 ID; //unique sequence id
}t_Packet;
What should be the most appropriate data structure which:
(1) allows to collect at least 8000 such packets (fast Insert and Delete operations)
(2) allows ver...
A simple question but I can't find the answer in my book. I want to read a binary file to seed a random number generator, but I don't want to seed my generator with the same seed each time I call the function, so I will need to keep a variable for my position in the file (not a problem) and I would need to know how to read a file startin...
I've prepared this simple example which is not working for me
#include <stdio.h>
#include <stdlib.h>
FILE *fp;
char filename[] = "damy.txt";
void echo (char[] text)
{
fp = fopen(filename, "a");
fwrite(text, 1, strlen(text), fp);
fclose(fp);
printf(text);
}
int main ()
{
echo("foo bar");
return 0;
}
It's supp...
I'm trying to test the sendfile() system call under Linux 2.6.32 to zero-copy data between two regular files.
As far as I understand, it should work: ever since 2.6.22, sendfile() has been implemented using splice(), and both the input file and the output file can be either regular files or sockets.
The following is the content of sendf...
Hi
A client of ours is asking us to implement a module in C in Apache webserver for performance reasons. This module should handle RESTful uri's, access a database and return results in json format. Many people here have recommended python mod_wsgi instead - but for simplicity of programming reasons. Can anyone tell me if there is a ...
Hi, in spite of having so many efficient data structures, why is only linked list used
so heavily in systems programming? Is it because it allows least usage of heap/less buggy code?
Regards,
Pwn
...
I'm trying to build an application I've downloaded which uses the SCONS "make replacement" and the Fast Light Tool Kit Gui.
The SConstruct code to detect the presence of fltk is:
guienv = Environment(CPPFLAGS = '')
guiconf = Configure(guienv)
if not guiconf.CheckLibWithHeader('lo', 'lo/lo.h','c'):
print 'Did not find liblo for OSC...
Hello.
Unfortunately, (written) midterms are necessary in most university CS programmes in the world. They tell us how well our students (and ourselves as teachers) are doing. Needless to say, designing midterms for a C Programming Language course is not easy. For instance, when we program for real, we have a myriad of information at ou...
Hi!
hey people I was writing a simple application to run a video stream using libvlc.But it seem that libvlc_media_player_get_time() function is not working properly.It is returning zero every time it is being called no matter how much video has been played.So can you please find out the possible remedies for it.
Also is there any signal...
I'm developing a text editor class (for a chat application) based on CRichEditCtrl (MFC) with emoticon support.
After i load the emoticon's bitmap, I use the function OleCreateStaticFromData to insert it into CRichEditCtrl. After that i just delete the bitmap object allocated by myself. I can verify (using a GDIView utility) that all r...
I hear the term virtual adapter from time to time. But not exactly sure what it is. I can't exactly find a good definition online. Is there an exact definition for a virtual adapter. If so, what is it. Or what does it usually mean ?
...
Ok, I know what a interface is, but since I got into C and working with COM objects (Component Object Model), it seems an interface in COM is a little different from the interface I know of.
So what I am trying to do is bridge the gaps here cause since I been learning C, alot of things have been sounding very familiar to me but are not ...
Possible Duplicate:
If free() knows the length of my array, why cant I ask for it in my own code?
Searching around (including here at stackoverflow), I got that malloc() allocates an array and also creates a header to control the array info.
In this header, there's also the array size. free() use such information to know how ...
Where are some good resources for looking at the pros/cons of different ways of implementing heap allocators? Resources touching on efficiency (fragmentation, throughput, etc) are preferred. I am NOT looking for simple code repositories.
edit:
I'm not really interested in the philosophical grounding of this wiki. As such, I don't reall...
Hi there!
I've an array, but I don't need its first (or last) position. So I point a new variable to the rest of the array, but I should free the array first/last position. For instance:
p = read_csv_file();
q = p + 1; // I don't need the first CSV file field
// Here I'd like to free only the first position of p
return q;
Otherwise I...
Hello. Right now I'm working in a simple Server that receives from client a code referring to a certain operation. The server receives this data and send back the signal that it's waiting for the proper data.
/*Server Side*/
if (codigoOperacao == 0)
{
pr...
I'm trying to use the C preprocessor on non-C code, and it works fine except for creating lines like this at the top:
# 1 "test.java"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.java"
The problem is that these lines aren't valid in Java. Is there any way to get the preprocessor to not write this stuff? I'd prefer not to have to ru...
It doesn't seem to make sense, unless we just ignore any potential excess space at the beginning of a segment, and then have the first allocated chunk be at the first multiple of 8 (with its corresponding first header being that address -4). This would leave however many bytes before that unused. Is that what's generally done?
edit:
tha...
I'm writing C for the PIC32MX, compiled with Microchip's PIC32 C compiler (based on GCC 3.4).
Added The standard I'm following is GNU99 (C99 with GNU extensions, compiler flag -std=gnu99)
My problem is this: I have some reprogrammable numeric data that is stored either on EEPROM or in the program flash of the chip. This means that when...