I'm newbie. Pointer make my crazy T_T.
Now, I'm do the socket programming project.
This is my code.
typedef struct {
char *ip[INET6_ADDRSTRLEN];
char *username[20];
time_t login_time;
enum client_state client_state;
int no_login;
} Client;
Client client[max_connections] = {}; // set to nu...
I need a C rounding function which rounds numbers like MATLAB's round function. Is there one? If you don't know how MATLAB's round function works see this link:
MATLAB round function
I was thinking I might just write my own simple round function to match MATLAB's functionality.
Thanks,
DemiSheep
...
TransformationMatrices[mesh_count-1][0] = n->mTransformation.a1;
TransformationMatrices[mesh_count-1][1] = n->mTransformation.a2;
TransformationMatrices[mesh_count-1][2] = n->mTransformation.a3;
TransformationMatrices[mesh_count-1][3] = n->mTransformation.a4;
TransformationMatrices[mesh_count-1][4] = n->mTransformation.b1;
Transformatio...
I'm newbie in C. I want to compare string that I use '#DEFINE' and char buf[256].
This is my code.
#define SRV_SHOWMENU "SRV_SHOWMENU"
#define SRV_LOGIN_TRUE = "SRV_LOGIN_SUC"
#define SRV_LOGIN_FAIL = "SRV_LOGIN_FAIL"
#define SRV_REGISTER_OK = "SRV_REGISTER_SUC"
#define SRV_REGISTER_FAIL = "SRV_REGISTER_FAIL"
char buf[256]; // buff...
Given the two code examples which is preferred? In the first the return variable is defined as a local variable. In the second the return variable is passed by the caller. Are you allowed to define a function and return a variable that was passed to it? I's this simply a preference of one or the other? is there a performance difference?
...
Hi!
I compile a C library on mac os x. When I typed the input and after printing on the screen the data I don't see something.
char *path = NULL;
peerdisplay = "Bob";
printf("Insert the full 'To' path: ");
scanf(" %a[^\n]",
printf("A path: %s \n",
When I replace the %a to %s, the printing ok, but after the running I have a segment...
I am working on an application wherein i need to compare 10^8 entries(alphanumeric entries). To retrieve the entries from file( file size is 1.5 GB) and then to compare them, i need to take less than 5 minutes of time. So, what would b the effective way to do that, since, only retrieving time is exceeding 5 min. And i need to work on fil...
I have a little problem with a C library: Byte Flood Cryptography. ( http://bfcrypt.sourceforge.net ).
I would create a program which use both linux sockets and Byte Flood Cryptography (the Byte Flood Cryptography functions are near from those provided from stdio.h, and this, I have understand).
I don't know how to 'bind' the two s...
Hi all,
I have here a small embedded device with uClinux.
There is a Boa web-server, that supports CGI scripts.
I need to make basic dynamic pages.
Requirements
GET method for navigation
POST method for forms
LOGIN for authentication
I found this page http://www.cs.tut.fi/~jkorpela/forms/cgic.html
There is described how to implemen...
I'd like a shortcut for the following little function, where
performance is very important (the function is called more than 10.000.000 times):
inline int len(uint32 val)
{
if(val <= 0x000000ff) return 1;
if(val <= 0x0000ffff) return 2;
if(val <= 0x00ffffff) return 3;
return 4;
}
Does anyone have any idea... a cool bi...
Hello,
I am currently writing a simple Theora video encoder, which uses libogg, libvorbis and libtheora. Currently, I can submit frames to the Theora encoder, and PCM samples to the Vorbis encoder, pass the resulting packets to Ogg streams (one for Theora and one for Vorbis) and get pages out.
When the program starts, it flushes the he...
Hi,
I am trying my hands with unix socket programming in C. But while reading I am getting Err No as 4. I am unable to find out the description of this error code. Does anybody have any idea?
...
I'm currently learning the network programming with C/C++... I have experience .NET but not in C (esp: in Unix network programming)
The problem that I'm facing right now is that when I receive the message, I like to split it into two parts. The format of message will be like [command] filepath (For example: get a.txt or put a.txt)
I'm ...
Hey All,
I'm writing some C where I'm going to need to store a very large graph as an adjacency matrix. I was going to hack up a quick graph implementation, but wanted to ask first if there are any good graph libraries for C (not c++) that people like.
I'm going to import the graph in some standard format (probably GML, but thats not a...
Does anyone know of an efficient implementation of a memcspn function?? It should behave like strcspn but look for the span in a memory buffer and not in a null terminated string. The target compiler is visualC++ .
Thanks,
Luca
...
I have the following question and from a systems perspective want to know how to achieve this easily and efficiently.
Given a task 'abc' that has been built with debug information and a global variable "TRACE" that is normally set to 0, I would like to print out to file 'log' the address of each function that is called between the time ...
i.e. -
int result;
result = 125/100;
or
result = 43/100;
Will result always be the floor of the division? What is the defined bahavior?
If you could point me in the right direction, i would appreciate it.
Thank You.
...
How can I verify two CRC implementations will generate the same checksums?
I'm looking for an exhaustive implementation evaluating methodology specific to CRC.
...
Hi all, i should compile a program written in C through a Makefile. I should insert into the Makefile, some option, for instance: -O2, -march=i686. How can I insert this option in the Makefile without write into it?
...
I'm writing a program that reads a stream of data and parses it into some values: either integers, floats, characters, or a compound value that contains a set of values (can be nested). How could I represent that in C? I was thinking of an union of int, float, char, then having an array of pointers to such unions for the compound value, ...