Skip to content

Instantly share code, notes, and snippets.

View water-air-flash's full-sized avatar

psychozhou water-air-flash

View GitHub Profile
#include "openssl/ssl.h"
#include "openssl/bio.h"
#include "openssl/err.h"
#include "stdio.h"
#include "string.h"
int main()
{
BIO * bio;
@water-air-flash
water-air-flash / Makefile
Created September 23, 2016 08:56 — forked from pramod-io/Makefile
Simple HTTP client in C
all:
gcc -Wall http_client.c -o http_client
clean:
rm *.o;rm http_client
@water-air-flash
water-air-flash / HttpRequest.c
Created September 23, 2016 08:52 — forked from cwt8805/HttpRequest.c
Windows下HTTP请求
#include <WinSock2.h>
#include <stdio.h>
#pragma comment(lib,"ws2_32.lib")
int main()
{
//构造socket
WSADATA data;
SOCKET sock;
@water-air-flash
water-air-flash / client_main.c
Created September 23, 2016 08:49
T2 – Cliente / Servidor Sockets
/*
http://www.gnu.org/software/libc/manual/html_node/Streams-and-File-Descriptors.html
11.1.1 Streams and File Descriptors
When you want to do input or output to a file, you have a choice of two basic mechanisms for
representing the connection between your program and the file: file descriptors and streams.
File descriptors are represented as objects of type int, while streams are represented as
FILE * objects.
@water-air-flash
water-air-flash / smartystring.c
Created September 23, 2016 08:32 — forked from bricef/smartystring.c
Dynamically growing a string in C.
#include <stdio.h>
#include <stdlib.h>
#define SMARTY_SIZE_INIT 16
typedef struct {
char * str; // a null terminated C string
char * end; // a pointer to the null byte, to be able to repeatedly append
// without using strlen() every time.
size_t size; // currently allocated size for *str, so we know when we
@water-air-flash
water-air-flash / main.c
Created September 23, 2016 08:31
Dynamic string implementation for C
#include <stdlib.h>
#include <stdio.h>
#include "string.h"
string *readline() {
string *buf = str_create("");
int c;
for(c = getchar(); c != EOF && c != '\n'; c = getchar()) {
str_cappend(buf, c);
/*****************************************************************************************************
*
* Sample:
* =======
*#include <stdio.h>
*#include "StringFunctions.h"
*
*
*int main(){
* char* orginal = "Hans hatte heute Wurst zum Frühstück";
@water-air-flash
water-air-flash / joinStrings.c
Created September 23, 2016 08:24 — forked from jeremyBanks/joinStrings.c
[2010-01] I guess I was trying string contactenation in C
//&>/dev/null;x="${0%.*}";[ ! "$x" -ot "$0" ]||(rm -f "$x";cc -o "$x" "$0")&&"$x" $*;exit
#import <stdio.h>
#import <stdlib.h>
char* joinStrings(char** strings, int numStrings, char* seperator) {
// Handle empty case which would cause problems.
if (numStrings == 0)
return "";
@water-air-flash
water-air-flash / string_sj.c
Created September 23, 2016 08:23 — forked from FurryHead/string_sj.c
C split/join functions, using strtok_r -- Source
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "string_sj.h"
int str_split(const char* src, const char* delims, char*** dest) {
char *s = strdup(src);
char *c, *saveptr, *tmp;
void *_tmp;
int num_tokens = 0, num_size = 10;
@water-air-flash
water-air-flash / AndroidManifest.xml
Created September 23, 2016 07:52 — forked from tiwiz/AndroidManifest.xml
Draw over other apps on Android 6
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />