c

Looking for an open source C/C++ image / video thumbnail generation libraries

I am looking for an open source C/C++ image/video thumbnail generation libraries. (other than ffmpeg or DevIL) ...

Is it ‘safe’ to remove() open file?

I think about adding possibility of using same the filename for both input and output file to my program, so that it will replace the input file. As the processed file may be quite large, I think that best solution would to be first open the file, then remove it and create a new one, i.e. like that: /* input == output in this case */ F...

state machines tutorials

Hello, C99 I am just wondering if anyone know of some good tutorials on the Internet for developing state machines. Or ebooks? I am starting working on state machines and just need something general to get me started. Many thanks, ...

C memory management error?

This is my C program: #include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> #include <ctype.h> #define FALSE 0 #define TRUE 1 typedef struct _Frag { struct _Frag *next; char *seq; int x1; int length; } Frag; typedef struct _Fragment { int type; Frag *frag_list; } Fragment; static void free_frags (Fr...

Is int *array[32] a pointer to an array of 32 ints, or an array of 32 pointers to int? Does it matter?

If I write int *columns[32]; am I defining an array with 32 pointers to ints? Or is it a pointer to an array of 32 ints? How do I differentiate between the two? Is there a difference? ...

How to turn Prim's algorithm into Kruskal's algorithm?

I've implemented Prim's algorithm in C (www.bubblellicious.es/prim.tar.gz) but I was just wondering how to transform this into Kruskal's algorithm. It seems they're quite similar, but I can't imagine how can I modify my old code into that new one. It'd be delicious if you give some advices or something. I know that's easy, but I'm still...

Help with C Pointers

Hi, I have a query with regards to pointers, can someone help explain the following to me? I do understand how the pointers work, however, I ain't too sure as to how overwriting parts of memory from addresses modify the behavior of the program. I will explain the following as much as I can according to what I understand, feel free to ...

Creating own FILE* pointer in C?

Hi, I had just a look at the stdio.h where I could find the FILE structure definition: typedef struct { int level; /* fill/empty level of buffer */ unsigned flags; /* File status flags */ char fd; /* File descriptor */ unsigned char hold; /* Unget...

LibCurl Unicode data

Hello! I'm writing an application, and I'm currently using libcurl. The libcurl callback function works fine when I implement it for the Ansi charset, but I fail to get it working when working with Unicode characters. int CURLConnectorAnsi::BufferWriter(char* data, size_t size, size_t nmemb, std::string* buffer) { int ReadBytes = 0...

How are array and pointer types handled internally in C compilers? ( int *a; vs. int a[]; )

I need a language lawyer with authoritative sources. Take a look at the following test program which compiles cleanly under gcc: #include <stdio.h> void foo(int *a) { a[98] = 0xFEADFACE; } void bar(int b[]) { *(b+498) = 0xFEADFACE; } int main(int argc, char **argv) { int a[100], b[500], *a_p; *(a+99) = 0xDEADBEEF; *(b+499...

What are the known C/C++ optimizations for GCC

I am have a lot of code that I need to optimize and make it run faster. I used opreport to tell me where the code spends a lot of time. I use the following command to get the statistics opreport -g -l -d Suggestions to get better statistics are appreciated using different flags, perhaps find it per line number instead of function numb...

What is the best way to get the most useful output from oprofile?

Using tools such as: opreport opcontrol opannotate I am starting to use this tool and trying to find the best combinations, examples to get the most out of profiling. Thanks ...

C# Convert.ToInt16(String) C Equivalent

What is the C equivalent of Convert.ToInt16(String) method of C#? In my case my string is a char array. Thanks ...

Which is faster/preferred: memset or for loop to zero out an array of doubles ?

double *d; int length=10; memset(d, length, 0); //or for (int i=length; i; i--) d[i]=0.0; ...

Switching callstack for C++ functions

Hi, Here's my previous question about switching C callstacks. However, C++ uses a different calling convention (thiscall) and may require some different asm code. Can someone explain the differences and point to or supply some code snippets that switch C++ callstacks (preferably in GCC inline asm)? Thanks, James ...

Handling special characters in C (UTF-8 encoding)

Hi! I'm writing a small application in C that reads a simple text file and then outputs the lines one by one. The problem is that the text file contains special characters like Æ, Ø and Å among others. When I run the program in terminal the output for those characters are represented with a "?". Is there an easy fix? ...

Build a DLL (without entry point) from the command line with MSVC.

Hi, I want to use MSVC compiler to build a DLL file. The problem is that the DLL doesn't have a main entry point. It's supposed to be a shared DLL used as a plug-in by an application. I can compile it using GCC this way: gcc -c plugin.c gcc -shared -o plugin.dll plugin.o interface.def The DEF file is to evade name mangling in a functi...

Expected primary-expression before ',' token in strsafe.h

I'm trying to rebuild someone's old C++ project using Dev-C++ (version 4.9.9.2) and the standard compiler that it comes with (I think g++ using MinGW) under Windows XP Pro SP3 32-bit. In one of the files strsafe.h is included and when I try to compile, I get this error: expected primary-expression before ',' token The lines of code th...

Asm IDE recommendations

Hello I want to learn some assembly . I installed nasm on my x86 windows machine . But I need recommendation for some IDE that i will be able to compile with my installed nasm through it , and of course that it will color the syntax . (maybe even debugger ) . I saw that notepad++ can color syntax but it not really Enough. Thanks f...

Array index limit in C

on linux, with 16 GB of ram, why would the following segfault: #include <stdlib.h> #define N 44000 int main(void) { long width = N*2 - 1; int * c = (int *) calloc(width*N, sizeof(int)); c[N/2] = 1; return 0; } According to gdb the problem is from c[N/2] = 1 , but I do not know the reason thanks ...