c

memcpy seems to be stuck

I am trying to use a memcpy for a size of 200K, and it stucks!!! Both destb and source are allocated. What could be the reason for this issue? ...

How to hint to GCC that a line should be unreachable?

It's common for compilers to provide a switch to warn when code is unreachable. I've also seen macros for some libraries, that provide assertions for unreachable code. Is there a hint, such as through a pragma, or builtin that I can pass to GCC (or any other compilers for that matter), that will warn or error during compilation if it's ...

To find all possible permutations of a given string.......

Hi, This is just to work out a problem which looks pretty interesting. I tried to think over it, but couldn't find the way to solve this, in efficient time. May be my concepts are still building up... anyways the question is as follows.. Wanted to find out all possible permutation of a given string....... Also, share if there could be a...

Porting NewLib: crt0

I am porting NewLib for my own OS by following a tutorial. It says that once I finished my crt0, I have to "link it as the first object". How can I do that? ...

correct form of declaration

what will be correct form of this code in c? char *x = malloc(100); code #include <stdlib.h> #include <stdio.h> int main(){ char *x=malloc(100); free(x); //in c++ // char *x=new char[100]; return 0; } here is errors 1>------ Build started: Project: memory_leaks, Configuration: Debug Win32 ------ 1>Build...

Mouse coordinates

How can i get mouse coordinates in C under Mac? ...

Can one use in a DLL, an external function that is provided by the main application instead of exporting DLL functions to the application?

e.g. In a static library I had void function (void); function(); And function() existed in the main application. But If I build it as a DLL the linker complains that the function is undefined on the DLL. ...

Is there any librtmp c# .net wrapper?

Is there any librtmp c# .net wrapper? ...

How to encrypt a text file using C?

I want to have a program like this: scanf("%s", name); scanf("%s", id); scanf("%d", &age); Now I want to write name, id and age to a file, but the file should be encrypted, so that only my program can read back the data it wrote. Do I need to use one of the encryption libraries mentioned here (they all are pretty heavy duty libraries...

Download HTTP thru sockets (C)

Hi, Recently I started taking this guide to get myself started on downloading files from the internet. I read it and came up with the following code to download the HTTP body of a website. The only problem is, it's not working. The code stops when calling the recv() call. It does not crash, it just keeps on running. Is this my fault? Am ...

[C, Mac] getyx return -1 -1

#include <stdio.h> #include <curses.h> int main () { int y, x; getyx( curscr, y, x); printf("x=%i, y=%i", x, y); return 0; } gcc a.c -lcurses -o a x=-1, y=-1 Why? ...

Getting local and greenwich time

In the following code, I try to get the local time and greenwich time and find the difference between them. But the output shows both the time values are equal: diff=0 iTm1=16:34 iTm2=16:34 <-----[gmtime is 13:34 actualy] When I just retreive gmtime, it works correctly. But when I retreive both local and gmtime, gmtime becomes equal t...

Reading child process' output as soon as some is available?

I've been trying various methods (popen, pipes + fork/exec, ...) to read a child process' output, all of which are working, but exhibit the same behavior: whenever I try to read the output using read/fread, it only returns when the buffer is completely full, or when the child exits. I'm looking for a behavior that's more like that of soc...

Distributed computing framework in c/c++

I am looking for a way to make distributed computing over a network (lan). Is there any good framework or a library for this purpose in C/C++. ...

How to read different files stored in a directory and store some data from them to one file

This is a follow up to the question I asked earlier and with the help of some people here I was able to start up with the function I want to write,but I am yet to complete it. Here is my earlier question: I have a series of files with the extension (.msr), they contain measured numerical values of more that ten parameters which ranges fr...

Arrays as function parameters

I'm trying to write a little CLI Hangman game, just to create something in C using my very limited set of language features, making the information so far stick. I haven't got to strings in the book yet, so I've created a so-called dictionary, which is a multi-dimensional array of characters, each row representing a word, and each colum...

C/C++ - is returning void a valid code?

I found out that the following code gets accepted by Visual C++ 2008 and GCC 4.3 compilers: void foo() { } void bar() { return foo(); } I am a bit surprised that it compiles. Is this a language feature or is it a bug in the compilers? What do the C/C++ standards say about this? ...

Printing array elements

The expected output of the following C program is to print the array elements. But when actually run, it doesn't do so. #include<stdio.h> #define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0])) int array[] = {23,34,12,17,204,99,16}; int main() { int d; for(d=-1;d <= (TOTAL_ELEMENTS-2);d++) printf("%d\n",array[d+1])...

Ch and CInt C interpreters

Possible Duplicate: Have you used any of the C++ interpreters (not compilers)? probable duplicate: http://stackoverflow.com/questions/69539/have-you-used-any-of-the-c-interpreters-not-compilers Who has used Ch and CInt? Does anyone have a preference for either? Differences/Disadvantages/ advantages of each? ...

Does printf() depend on order of format specifiers?

#include<stdio.h> main() { float x=2; float y=4; printf("\n%d\n%f",x/y,x/y); printf("\n%f\n%d",x/y,x/y); } Output: 0 0.000000 0.500000 0 compiled with gcc 4.4.3 The program exited with error code 12 ...