I have a function that I would like to be able to return special values for failure and uninitialized (it returns a pointer on success).
Currently it returns NULL for failure, and -1 for uninitialized, and this seems to work...but I could be cheating the system. iirc, addresses are always positive, are they not? (although since the comp...
Is there any way you do something like...
#define { { printf("%s,%s",_FUNCTION_, _LINE_); {
this won't compile. But I'm wondering if there is some kind of trick to effectively get the same functionality? (other than writing a tool to hook at the preprocessing step)
The point of doing this is a pondering on how to get a poor mans...
The idea is that a project has a single file with __DATE__ and __TIME__ in it. It might be cool to have it recompiled without explicitly changing its modification date.
edit: $(shell touch -c ..) might be a good solution if only clumsy.
...
any existing function to do that in c?
...
I know that we can use several commands to access and read memory: for example, print, p, x...
But how can I change the contents of memory at any specific location (while debugging in GDB)?
Thanks for any info.
...
I am having 64 bit Windows 7 as my operating system and want to run some c programs. Is there a compiler for the same? I mean a 64 bit c compiler.
...
The title pretty much says it all, so here's the code:
#include <stdio.h>
/* Program counts blanks, tabs, and newlines */
int main(void)
{
int c;
int b, t, nl;
b = 0;
t = 0;
nl = 0;
while ((c = getchar()) != EOF)
if (c == ' ')
++b;
if (c == '\t')
++t;
if (c == '\n')
++nl;
printf("Input has ...
Lately, I've been working on some small data serialization demos. However, I was wondering how to transfer binary data from a structure into a file descriptor.
I am aware that the only (simple) way to do this is through fwrite (if write does this, then please say so), so is there either:
A) An fwrite call to use on file descriptors?
o...
Hi,
Could someone direct me to some tutorial on Tree Data Structures using C. I tried googling but most implementations are for C++ or Java.If someone can point me to some online tutorials that are in C it would be great.
Thanks..
...
Some (many? all?) 64-bit1 Linux distros allow running 32-bit applications by shipping parallel collections of 32-bit and 64-bit libraries (including libc). So a 32-bit application can link against 32-bit libs and be run by a 64-bit kernel.
I'd like to know the mechanics of how 32-bit applications make system calls on a 64-bit kernel. I ...
I am developing a window application in Microsoft visual C # 2008 express edition.I get a run time error wen i run the application.
string[] diskArray;
string driveNumber;
string driveLetter;
**searcher1 = new ManagementObjectSearcher("SELECT * FROM Win32_LogicalDiskToPartition");**
foreach (Mana...
I found the following algorithm to generate polygon outlines:
void CGlShape::GenerateLinePoly(std::vector<DOUBLEPOINT> &input, int width)
{
OutlineVec.clear();
if(input.size() < 2)
{
return;
}
if(connected)
{
input.push_back(input[0]);
input.push_back(input[1]);
}
float w = width / 2.0f;
//glBegin(GL_TRIANGLES);
for...
"Write a program to copy its input to
its output, replacing each string of
one or more blanks by a single blank."
I'm assuming by this he means input something like...
We(blank)(blank)(blank)go(blank)to(blank)(blank)(blank)the(blank)mall!
... and output it like:
We(blank)go(blank)to(blank)the(blank)mall!
This is prob...
Possible Duplicates:
What does : number after a struct field mean?
What does unsigned temp:3 means
Hello everyone, I hate to ask this type of question, but it's really bugging me, so I will ask:
What is the function of the : operator in the code below?
#include <stdio.h>
struct microFields
{
unsigned int addr:9;
unsig...
I came across a very interesting book. I have done some 2d games but 3D is a whole new ballpark for me. I just need to know if there any benefits of learning 3d software rasterization & theory before jumping into OpenGL/Direct3D? Any reason why to either approach? Thanks in advanced!
...
Hi,
I have studied Tries and Suffix Trees and wanted to implement the same.... Please share some weblinks where in i can get an idea about the structure and basic idea of implementation to start with.......
Any good examplee, if included... would be a pluss...
Implementation in C.......
Thankss..
...
I am developing a GTK based application which has to support clipboard. For that I am exporting selection data using gtk_clipboard_set_with_data with the target formats: UTF8_STRING, STRING, TEXT, COMPOUND_TEXT, text/plain, text/plain;charset=utf-8, text/rtf, text/html and text/url. Using this I am able to copy-paste text from my aplicat...
Hello again gurus,
I have compiled some external C++ code into a dll, thirdpartycode.dll, using Visual Studio 2008. The code is wrapped in extern "C".
Since I am cross compiling, creating a 64 bit dll on my 32 bit machine; I am using x64 as "Active solution platform" in the "Configuration Manager".
My thirdpartycode.dll compiles and li...
what is the standard way to copy two structs that contain char arrays? Here is some code
#include stdio.h>
#include string.h>
#include stdlib.h>
typedef struct {
char* name;
char* surname;
} person;
int main(void){
person p1;
person p2;
p1.name = (char*)malloc(5);
p1.surname = (char*)malloc(5);
str...
I'm writing a database-style thing in C (i.e. it will store and operate on about 500,000 records). I'm going to be running it in a memory-constrained environment (VPS) so I don't want memory usage to balloon. I'm not going to be handling huge amounts of data - perhaps up to 200MB in total, but I want the memory footprint to remain in the...