/*
* GET-HOST-INFO . C
*
* Get information for a host.
*/
#include <stdio.h>
#include <netdb.h>
#include <arpa/inet.h>
Type: Posts; User: manav-II
/*
* GET-HOST-INFO . C
*
* Get information for a host.
*/
#include <stdio.h>
#include <netdb.h>
#include <arpa/inet.h>
/*
* M Y - D A Y - T I M E - S E R V E R . C
*
* Day time server. Uses port 13, needs root permissions to run!
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>...
Kill a process by name (or command line):
[Linux specific may be]
#include <stdio.h>
int main(int argc, char **argv) {
int pid;
FILE *p;
char buff[256];
Thanks Mats.
Yeah, I too noticed, that, my formatting was too dense, and hard on eyes.
But when I tidy up the code it becomes even harder to understand, the function that was fitting on one page...
Not exactly. Just felt the need.
For example in Perl I could do this:
my @lines = <FILE>;
now in C I can get very close to that, by doing this:
char **lines = read_lines(in, &count);
sorry guys, just a copy/paste blooper :confused:
linked list data structure and utility functions.
/* Bugs? Please report :) */
struct node {
int item;
struct node *next;
struct node *prev;
};
postfix expression parser.
/*
* FIXME
* There may be bugs. Especially with the stack. Please report them.
*/
static void postfix_err_die(char *p, int offset, char *msg) {
...
thanks Mats, i will post a modified version later.
arithmetic expression parser.
/*
* This is an infix expression parser. The parser disregards the precendence of operators.
* For...
thanks for all the feedback.
i had thought that to make it work for stdin, i can read all the input and save it to a file, so that the above method works.
otherwise my approach would be:
read a...
read_line & read_lines from a FILE *
/*
* FIXME
* Fails for stdin.
* There may be bugs. Please report them.
*/
char *read_line(FILE *in) {
char *line;
hope it helps someone. but will serve as a quick access for me.
thanks to all! problem is fixed now.
Hi all,
how to handle (or just get notified about) a keyboard or mouse event happened for any open window OR desktop itself.
what I want to do is just run in a loop sleeping 1 second before...
please see the comments in code, can someone tell me why it works this way and fails the other way. i was trying to access the elements of the enum nested inside Logger class...
class Logger
{...