Apple's CoreGraphics library defines two functions for describing an arc.
CGPathAddArc adds an arc based on a center point, radius, and pair of angles.
CGPathAddArcToPoint adds an arc based on a radius and a pair of tangent lines.
The details are explained in the CGPath API reference. Why two functions? Simple convenience? Is one ...
In the C programming language and Pthreads as the threading library; do variables/structures that are shared between threads need to be declared as volatile? Assuming that they might be protected by a lock or not (barriers perhaps).
Does the pthread POSIX standard have any say about this, is this compiler-dependent or neither?
Edit to ...
I'm a beginning C++ programmer / network admin, but I figure I can learn how to do this if someone points me in the right direction. Most of the tutorials are demonstrated using old code that no longer works for some reason.
Since I'm on Linux, all I need is an explanation on how to write raw Berkeley sockets. Can someone give me a qui...
When can 64-bit writes be guaranteed to be atomic, when programming in C on an Intel x86-based platform (in particular, an Intel-based Mac running MacOSX 10.4 using the Intel compiler)? For example:
unsigned long long int y;
y = 0xfedcba87654321ULL;
/* ... a bunch of other time-consuming stuff happens... */
y = 0x12345678abcdefULL;
I...
I've been running into a peculiar issue with certain Java applications in the HP-UX environment.
The heap is set to -mx512, yet, looking at the memory regions for this java process using gpm, it shows it using upwards of 1.6GBs of RSS memory, with 1.1GB allocated to the DATA region. Grows quite rapidly over a 24-48hour period and the...
Using only ANSI C, what is the best way to, with fair certainty, determine if a C style string is either a integer or a real number (i.e float/double)?
...
What is the fastest way you know to convert a floating-point number to an int on an x86 CPU. Preferrably in C or assembly (that can be in-lined in C) for any combination of the following:
32/64/80-bit float -> 32/64-bit integer
I'm looking for some technique that is faster than to just let the compiler do it.
...
I have developped software in C++, Java, PHP, .Net and now I am interesting to learn to program material thing. I would like to program system that could interact with IR, LCD and to be able to resuse old printer motor to use it, etc.
My problem is where to start? I have searched the web and have found an open source board called Arduin...
Frameworks simplify coding at the cost of speed and obfuscation of the OS. With the passing of Moore's law do you thing that there might be a shift away from Frameworks?
I suspect that one of the reasons for Vista not being an outstanding success was that it ran much slower than XP, and, because computers had not improved as greatly i...
I've drawn an ellipse in the XZ plane, and set my perspective slightly up on the Y-axis and back on the Z, looking at the center of ellipse from a 45-degree angle, using gluPerspective() to set my viewing frustrum.
Unrotated, the major axis of the ellipse spans the width of my viewport. When I rotate 90-degrees about my line-of-sight...
What literature(written or otherwise) would you recommend for someone new to the world of coding? I would prefer something about C, but if you have any other suggestions, what are they?
...
I've had a new found interest in building a small, efficient web server in C and have had some trouble parsing POST methods from the HTTP Header. Would anyone have any advice as to how to handle retrieving the name/value pairs from the "posted" data?
POST /yeah HTTP/1.1
Host: cor.cs.uky.edu:7017
User-Agent: Mozilla/5.0 (Windows; U; Wind...
In C, using the standard Windows API, what is the best way to read an unformatted disk? Specifically, I have an MMC or SD card with data, but no file system (not FAT16, not FAT32, just raw data). If there was a simple way to open the entire card for byte by byte binary access, that would be great.
Thanks!
...
struct foo { unsigned x:1; } f;
printf("%d\n", (int)sizeof(f.x = 1));
What is the expected output and why? Taking the size of a bitfield lvalue directly isn't allowed. But by using the assignment operator, it seems we can still take the size of a bitfield type.
What is the "size of a bitfield in bytes"? Is it the size of the storage...
For many questions, especially for C-related ones, the answer seems to be found in "the standard". However, where do we find that - online?
Googling can sometimes feel futile, again especially for the C standards, since they are drowned in the flood of discussions on programming forums ;)
To get this started, since these are the ones I...
I am trying to use MinGW to compile a C program under Windows XP. The gcc.exe gives the following error:
stdio.h : No such file or directory
The code (hello.c) looks like this:
#include < stdio.h >
void main()
{
printf("\nHello World\n");
}
I use a batch file to call gcc. The batch file looks like this:
@echo off
set OLDPATH=%...
While implementing an applicative server and its client-side libraries in C++, I am having trouble finding a clean and reliable way to stop client processes on server shutdown on Windows.
Assuming the server and its clients run under the same user, the requirements are:
the solution should work in the following cases:
clients may...
Hello
We need to programatically burn files to CD in a C\C++ Windows XP/Vista application we are developing using Borlands Turbo C++.
What is the simplest and best way to do this? We would prefer a native windows API (that doesnt rely on MFC) so as not to rely on any third party software/drivers if one is available.
Any good examples ...
I found this open-source library that I want to use in my Java application. The library is written in C and was developed under Unix/Linux, and my application will run on Windows. It's a library of mostly mathematical functions, so as far as I can tell it doesn't use anything that's platform-dependent, it's just very basic C code. Also, ...
Test the following code:
#include <stdio.h>
#include <stdlib.h>
main()
{
const char *yytext="0";
const float f=(float)atof(yytext);
size_t t = *((size_t*)&f);
printf("t should be 0 but is %d\n", t);
}
Compile it with:
gcc -O3 test.c
The GOOD output should be:
"t should be 0 but is 0"
But with my gcc 4.1.3, I have...