I learned today that there are digraphs in C99 and C++. The following is a valid program:
%:include <stdio.h>
%:ifndef BUFSIZE
%:define BUFSIZE 512
%:endif
void copy(char d<::>, const char s<::>, int len)
<%
while (len-- >= 0)
<%
d<:len:> = s<:len:>;
%>
%>
My question is: why do they exist?
...
hi all,
I m looking to write some quality C code.
Can someone point me to some articles , websites..whatever
I need something with examples.
I have already seen and read K&R C book.
But times have changed, some one must have more to say on quality C Code.
and another important thing is How do you ensure that you as programmer have wri...
I've always heard that C is the language of choice to use for embedded systems, or anything that needs to run at maximum speed. I never developed a fondness for C, mostly because I don't like pointer arithmetic and the language is barely a rung above assembler.
On the other hand, ML languages are functional, garbage collected languages...
I'm looking for a portable and easy-to-use string library for C/C++, which helps me to work with Unicode input/output. In the best case, it will store its strings in memory in UTF-8, and allow me to convert strings from ASCII to UTF-8/UTF-16 and back. I don't need much more besides that (ok, a liberal license won't hurt). I have seen th...
What XML libraries are out there, which are minimal, easy to use, come with little dependencies (ideally none), can be linked statically and come with a liberal license? So far, I've been a pretty happy user of TinyXML, but I'm curious what alternatives I have missed so far.
...
Hi all,
I'm looking for an API or an application that can cache data from a file or database.
My idea is that I have an application that reads a database, but the access to database is sequential and it is on a disk.
What I basically want to do is get the data from cache first and then if it doesn't exist in cache, then hit the databas...
As I am currently doing this project in only C, I've up untill this point only used my webserver as a single threaded application. However, I dont want that anymore! So I have the following code that handles my Work.
void BeginListen()
{
CreateSocket();
BindSocket();
ListenOnSocket();
while ( 1 )
...
Hi guys
I'm a junior student in IT. I am facing a problem with the output of the program.
The idea of the program is that I should use functions to read an array of 10 elements, then get the average of the elements, then get the the max and min. I've got the max and min right but the average is showing weird stuff. Please check the cod...
I'm trying to convert a struct to a char array to send over the network. However, I get some weird output from the char array when I do.
#include <stdio.h>
struct x
{
int x;
} __attribute__((packed));
int main()
{
struct x a;
a.x=127;
char *b = (char *)&a;
int i;
for (i=0; i<4; i++)
printf("%02x ", b[i]);
...
I'm admittedly a straight-C newbie, but this has got me stumped. I'm working on a linked list implementation for practice, and I'm getting a segfault by simply adding a variable to the split_node function:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct Node {
struct Node *child;
char *content;
};
void print_list(s...
In C++, sizeof('a') == sizeof(char) == 1. This makes intuitive sense, since 'a' is a character literal, and sizeof(char) is defined to be 1 by the standard. But in C, sizeof('a') == sizeof(int). That is, it appears that C character literals are actually integers. Does anyone know why? I can find plenty of mentions of this C quirk but no ...
Hi,
Many of the standard c library (fwrite, memset, malloc) functions have direct equivalents in the windows API (WriteFile, FillMemory/ ZeroMemory, GlobalAlloc).
Apart from portability issues, what should be used, the CLIB or windows API functions?
Will the C functions call the winapi functions or is it the other way around?
thanks...
Is there any function in c# equivalent to C's stdio function ungetc() ?
...
To be truly standards-compliant, must all functions in C (except for main) have a prototype, even if they are only used after their definition in the same translation unit?
...
I have a C code base and need to programmatically identify all of the global variables used. I think that gcc can be made to produce a memory map file but don't know how and this might let me see which variables are global? Any help would be appreciated.
Cheers
...
I want to create a log file for my webserver written in C under UNIX.
The logfile should be formatted according to Common Log Format, but I don't know how to get the ident and authuser from the connecting socket.
Is there a simple way to get these from the socket?
...
Joel and company expound on the virtues of learning C and how the best way to learn a language is to actually write programs using that use it. To that effect, which types of applications are most suitable to the C programming language?
Edit:
I am looking for what C is good at. This likely does not coincide with the best way of learni...
If I write a #define that performs an operation using other preprocessor constants, is the final value computed each time the macro appears at runtime? Does this depend on optimizations in the compiler, or is it covered under a standard?
Example:
#define EXTERNAL_CLOCK_FREQUENCY 32768
#define TIMER_1_S EXTERNAL_CLO...
I've only had to code in C a few times, and it seems like every time I do, it becomes some unmanageable beast.
I've done most of my programming in C# and .Net so I am very accustomed to the class style architecture, but I can't seem to grasp organization in C applications. Should I put functions that are related in a certain file, put f...
In C if you have a certain type of packet, what you generally do is define some struct and cast the char * into a pointer to the struct. After this you have direct programmatic access to all data fields in the network packet. Like so :
struct rdp_header {
int version;
char serverId[20];
};
When you get a network packet you can do ...