Why does the SQLite C/C++ API return unsigned char *s for text values as opposed to the more de-facto char * type?
This is somewhat related to the unsigned char question, except that the SQLite API's decision seems opposite of the conventional char * advice given for string-like values.
For example:
const unsigned char *sqlite3_column...
In a program to find whether the given number is an Armstrong number, I stored the input no (3 digit) as string as follows.
char input[10];
scanf("%s",&input);
Now I have to calculate cube of each digit by using pow method of math.h as follows.
int a;
a = pow(input[0],3);
By coding like this, I could not get correct result. If I p...
Why main must be declared as if it has external linkage?
Why it should not be static?
what is meant by external linkage??
...
I have a library consisting of approx 100 source files. I want one of the sources to be always rebuilt if any of the other files have been compiled but I dont want it built every time I run the make/build.
Basically I want this file to have the last build date/time built into it so any application linking to the library can check the la...
I am currently doing some socket programming using C/C++. To be able to use a somewhat cleaner interface, and a more OO structure, I decided to write a few simple wrapper classes around parts of the C socket API, but while doing so I stumbled upon a problem:
Given the following code:
// Global method
int foo(int x)
{
return x;
}
/...
Hi all,
I am currently doing a little study over Sonar and (why not) other tools to manage code quality.
I did not found the documentation much clear nor extended and I have some questions.
Does somebody know and use it ? How can one integrate sonar into a complex project ? Can we manage a Perl or C project with Sonar & Maven 2?
I wo...
For example, never define a macro like this:
#define DANGER 60 + 2
This can potentially be dangerous when we do an operation like this:
int wrong_value = DANGER * 2; // Expecting 124
Instead, define like this because you don't know how the user of the macro may use it:
#define HARMLESS (60 + 2)
The example is trivial, but that p...
Are there any libraries or guides for how to read and parse binary data in C?
I am looking at some functionality that will receive TCP packets on a network socket and then parse that binary data according to a specification, turning the information into a more useable form by the code.
Are there any libraries out there that do this, or...
What's the best way to convert a date string, formatted as "MM-DD-YY HH:MM:SS", to a time_t value in either C or C++?
...
Is there a good equivalent implementation of strptime() available for Windows? Unfortunately, this POSIX function does not appear to be available.
Open Group description of strptime - summary: it converts a text string such as "MM-DD-YYYY HH:MM:SS" into a tm struct, the opposite of strftime().
...
I have an application that was developed for Linux x86 32 bits, there are lots of floating-point operations and a lot of tests depending on the results. Now we are porting it to x86_64 but the test results are different in these architecture. We don't want to keep a separate set of results for each arch.
According to this article the pr...
I have some numeric code that I need to convert to C or C++. I tried using f2c, but it won't work on the Fortran code. f2c complains because the code uses C style preprocessor directives (#include).
The code's readme states that it is Fortran77, that works with the fort77 linker, that would expand those includes.
Does anyone know how t...
I would like to know difference between static variables and global variables in terms of access speed and space consumption. (If you want to know my platform: gcc compiler on Windows. (I am using Cygwin with Triton IDE for ARM7 embedded programming on windows. Triton comes with gcc compiler on Java platform which can be run on Windows.)...
I'm making a simple IRC Bot in C. And I finally got the bot connecting and receiving information. My code is supposed to be sending as well, but the server is acting as if it is not sending anything. When The bot connects, I receive this:
Recieved: :roc.esper.net NOTICE AUTH
:*** Looking up your hostname...
Recieved: :roc.espe...
I'm working with C and through a socket I will be receiving a message with one space in it, I need to split the string into parts at the space. How would I go about doing this?
...
How does the C/C++ compiler manipulate the escape character ["\"] in source code? How is compiler grammar written for processing that character? What does the compiler do after encountering that character?
...
Do you know a simple script to count NLOCs (netto lines of code). The script should count lines of C Code. It should not count empty lines or lines with just braces. But it doesn't need to be overly exact either.
...
Under what circumstances should I expect memcpys to outperform assignments on modern INTEL/AMD hardware? I am using GCC 4.2.x on a 32 bit Intel platform (but am interested in 64 bit as well).
...
Why are the split lists always empty in this program? (It is derived from the code on the Wikipedia page on Linked Lists.)
/*
Example program from wikipedia linked list article
Modified to find nth node and to split the list
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct ns
{
int data;
struct ns *next; /* p...
Like this: const void * test = sqlite3_column_blob(stat, 1);
Can I delete or delete[] test?
...