c

Difference between the int * i and int** i

What is the difference between int* i and int** i? ...

Resource files or 'CreateWindow' function for GUIs?

My program has a static interface, but I don't know what's the best way to make my interface. With resource files or with the CreateWindow function using the WM_CREATE message? Thanks ...

how to parse HTTP POST(file upload) stream?

I am using actionscript engine to upload a file, the engine will select the file and send the file over network thru HTTP POST command, the document says the POST message is like: POST /handler.cfm HTTP/1.1 Accept: text/* Content-Type: multipart/form-data; boundary=----------Ij5ae0ae0KM7GI3KM7ei4cH2ei4gL6 User-Agent: Shockwave...

Which Blowfish algorithm is the most 'correct'?

I'm running Windows Server 2k8 (maybe that's half the problem?) Anyway, I'm getting different values out of different Blowfish modules in various languages. Is there one which can be relied upon as the standard? For the following examples, assume the key is password and the plaintext 12345678. a. The Online Encrypt Tool with Algorithm ...

Printing a string in C using a function

I'm brand new to C and am trying to learn how to take a string and print it using a function. I see examples everywhere using while(ch = getchar(), ch >= 0), but as soon as I put it into a function (instead of main()), it ceases to work. Right now, it's stuck in an endless loop... why is that? // from main(): // printString("hello"); v...

c syntax problem w/some changes now

Right now I am only trying to get my getline() function to work. I have the code from the book and it seems to be identical, but I cant get it to compile. This is homework but this part should be just copying from the book. #include <stdio.h> #include <stdlib.h> #include <math.h> //error list #define ENDOFFILE = -1; #define TOOMANYN...

Trying to compile LzmaUtil.c from LZMA SDK

I wish to use LZMA natively in my own C util. I've downloaded LZMA SDK from http://www.7-zip.org/sdk.html (version 9.12 beta) - but I simply fail to compile their LzmaUtil. This is what I've tried, using MinGW: gcc -c -O2 -Wall -D_7ZIP_ST LzmaUtil.c ../../Alloc.c ../../LzFind.c ../../LzmaDec.c ../../LzmaEnc.c ../../7zFile.c ../../7zStr...

Converting a simple C code into a CUDA code

Hello, I'm trying to convert a simple numerical analysis code (trapezium rule numerical integration) into something that will run on my CUDA enabled GPU. There is alot of literature out there but it all seems far more complex than what is required here! My current code is: #include <stdio.h> #include <math.h> #include <stdlib.h> #defi...

Print file (of any length) character by character in C

Is there a way to print an entire file, character by character, without know it's length or worrying about how many lines it has? Right now I read a file and count how many lines it has, read each line, send it to a manipulation function print the manipulated string out. I had to create a countLines() function and a readLine() function ...

Heading the right way on c matrix code?

My instructor said the way to start this is to use the getline() function from out book, then get the numbers from the line, then have those numbers in matrix form, I do not understand why I would use getline? //eventually this code should take in a square matrix and from 2x2 to 6x6 //the plan is to get it to read in a line, then get t...

Why does open make my file descriptor 0?

I'm working on a program that is using a pipe and forks and need to change the write end to an output file. But when I open a file the file descriptor is 0 which is usually stdin but which I think is the cause of some of my problems. Here is my code outputfd = open("file", O_RDWR | O_CREAT | O_TRUNC) == -1 Can someone let me know wh...

OpenGL Buffer Object internal workings?

I've started to use Pixel Buffer Objects and while I understand how to use them and the gist of what they're doing, I really don't know what's going on under the hood. I'm aware that the OpenGL spec allows for leeway in regards to the exact implementation, but that's still beyond me. So far as I understand, the Buffer Object typically r...

wu's antialiasing algorithm

function plot(x, y, c) is plot the pixel at (x, y) with brightness c (where 0 ≤ c ≤ 1) function ipart(x) is return integer part of x function round(x) is return ipart(x + 0.5) function fpart(x) is return fractional part of x function rfpart(x) is return 1 - fpart(x) function drawLine(x1,y1,x2,y2) is dx = x2 -...

Initialize an array using openmpi once

I am trying to run some tests using OPENmpi processing data in an array by spliting up the work across nodes (the second part is with matricies). I am running into some problems now because the data array is being initialized every time and I don't know how to prevent this from happening. How, using ANSI C can I create a variable leng...

insertion sort code using insert and insertsort!

i have written a code for insertion sort but it is nt sorting.. kindly help me out in making the desired changes to mycode. thanx #include<stdio.h> int compare(int a,int b) { if(a>b) return 1; else if( a<b) return -1; else if(a==b) return 0; } void insert(int m, int ms[], int size) { int j,k; for (j=0; j<size; ...

How can I proxy mmap reads and writes across a network?

I'm working on software to control a mmap'd device on an embedded ARM system, but have run into a few situations where the debugging and development tools available haven't been sufficient. i.e. Instrumentation tools like valgrind and higher end thread profilers are unavailable. What I'd like to do is compile my code on an x86 machine, ...

How to remove a carriage return from a string in C ?

Possible Duplicate: Remove characters from a string in C Do you have an example of C code to remove carriage returns in a string? ...

Returning "non-ints" from yylex

I have a generated scanner from flex which the output from is not consumed by yacc or bison. yylex() needs to returns a pointer to a token-like structure memory instead of an int indicating the token-type. // example definition from foo.l [A-Za-z_][A-Za-z0-9_]* { return scanner_token(T_IDENTIFIER); } // example implementation of scanne...

Tokenize an environment variable and save the resulting token in a char**

Hi. I'm attempting to create an array of strings that represent the directories stored in the PATH variable. I'm writing this code in C, but I'm having trouble getting the memory allocation parts working. char* shell_path = getenv ("PATH"); char* tok = strtok (shell_path, SHELL_PATH_SEPARATOR); int number_of_tokens = 0, i = 0; while (...

How to compile assembly language in c

Hi, I am looking at lots of assembly language code that is compiled along with c. They are using simple #define assembly without any headers in boot.s code. How does this work ? ...