The definition of library function strspn is:
size_t strspn(const char *str, const char *chars)
/*Return number of leading characters at the beginning of the string str which are all members of string chars.*/
e.g. if ‘str’ is “fecxdy” and ‘chars’ is “abcdef” then the function would return 3, since ‘f’, ’e’ and ‘c’ all appear somewhe...
Folks, here is an implementation of memset(), however I have been told that there is one logical mistake in the code. Could you help me find it.
I feel that a double pointer for the target string should be passed to this function, which will be like passing the address of the pointer variable and not the pointer itself.
I am getting a...
When compiling shared libraries in gcc the -fPIC option compiles the code as position independent. Is there any reason (performance or otherwise) why you would not compile all code position independent?
...
Please explain the difference between a binary search tree and m-way tree?
...
The environment is Solaris on 32bit SPARC, but I think this is a more general issue with dynamic linking and/or position independent code.
I have an assembly program that I compile as position independent code and dynamically link to it from a C program. It works fine, except that I can't refer to any memory reserved by the assembly pro...
Hi there,
Somewhere back in time i did some C and C++ in college, but I didn't get to many attention to C++. Now I wish to pay some attention to C++ but when I'm using getch() function, i get the warning from below.
Warning C4996: 'getch': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _getch. Se...
I’m working on with an embedded device that is connected to PC using rs232 (rs232 over USB).
I’m thinking about developing my own protocol:
<MAGIC><LENGTH><BINARY DATA><CRC>
but I don’t want to reinvent the wheel.
Please note that: I'm thinking about quite restricted device: 4kb of RAM, no kernel, nor standard C lib.
Can you think...
What are some C/c++ Machine learning libraries that supports clustering of multi dimensional data? (for example K-Means)
So far I have come across
SGI MLC++ http://www.sgi.com/tech/mlc/
OpenCV MLL
I am tempted to roll-my-own, but I am sure pre-existing ones are far better performance optimized with more eyes on code.
...
Duplicate of: There is a function to use pattern matching (using regular expressions) in C++?
I'm not sure where one would use it... are there any parser-type functions that take some regex as an argument or something? I just found out that my editor will highlight a line after / as "regex" for C/C++ syntax which I thought was weird...
...
Hi, I work on code something like this
... HEADERS ...
int *var;
void child() {
... //some work
free(var);
exit(EXIT_SUCCESSFUL);
}
int main(void) {
...
//allocate variable
var = (int *) malloc(N*sizeof(int));
... //work with var
for(int i; i<PROC_COUNT; i++) {
pid_t child = fork();
if(pid == 0) {
child...
I've been excited about llvm being low enough to model any system,
and saw it as promising that Apple was adopting it;
but then again Apple doesn't specifically support Haskell;
and, some think that Haskell would be better off with c-- :
That LLVM'ers haven't solved the problem of zero-overhead garbage collection
isn't too surpris...
I find my self in need of a line drawing package. I need to pop a window and draw lines and points. Text would be nice but I can live without it. Most importantly, I need something that is dirt simple to get running. I don't have time to dink around with libs (if I did have time I'd be willing but I'm already way behind as it is).
I'd p...
Example: A function that takes a function (that takes a function (that ...) and an int) and an int.
typedef void(*Func)(void (*)(void (*)(...), int), int);
It explodes recursively where (...). Is there a fundamental reason this can't be done or is there another syntax? It seems to me it should be possible without a cast. I'm really tr...
Shouldn't be hard, right? Right?
I am currently trawling the OpenAFS codebase to find the header definition of pioctl. I've thrown everything I've got at it: checked ctags, grepped the source code for pioctl, etc. The closest I've got to a lead is the fact that there's a file pioctl_nt.h that contains the definition, except it's not act...
I am working on a real-time syntax highlighter for the iPhone and I have created a custom UIView that takes a string, parses it and then highlights it in its drawRect: method. I've also implemented a blinking cursor. However, it is starting to get a little slow and I think that when I implement multi-line processing and chunk-processing,...
I have the following problem situation. A bunch of data is split across 10k small files (approx. 8-16 kib each). Depending on user input, I have to load these as fast as possible, and process them. More precisely, each data packet can be split into 100-100k files, and there are approximately 1k data packets. Most of them are the smaller ...
Hi, could someone take a quick look at this C code and see why I get the compiler error? It is a function for entering details into a calendar structure, and should create one node, i.e. one 'event' on the calendar.
struct event enter_key(void)
{
int day,month,year,starttime,endtime,length;
char* descp;
struct event*...
I have a directory that has the following files
Build
asc2uni.c
asc2uni.1
I have to compile it, but the problem is I don't know how what is the compiler to use for this format and how to do it. Any ideas?
Edit: I am trying to compile this on Windows XP.
Edit 2: The Build file content:
cc -I../Modules -O -o asc2uni asc2uni.c ../M...
Hi,
Any good place to learn about POST and how to design and code one? I am a C++ programmer and quite baffeled with the term.
Thanks
...
Many years ago while working on a tight graphics I/O problem, Tom Duff unrolled a loop and created his Duff's Device as follows:
dsend(to, from, count)
char *to, *from;
int count;
{
int n = (count + 7) / 8;
switch (count % 8) {
case 0: do { *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
ca...