Kinda hard to play a new card game without any instructions or rule book.
A forum for users of LackeyCCG
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu<s><l>Use Fist</l><f>/say Fist: Damage = 9 x;/rolld6</f></s>
# in Python
import ctypes
c_checksum = ctypes.CDLL('checksum.so') # would just be 'checksum' on Windows, I think
def get_checksum(filename):
"""Calls the (mostly) original C++ function."""
# str(filename) is so this function can be called with a Path object too
string_argument = ctypes.create_string_buffer(str(filename).encode())
return c_checksum.get_checksum(string_argument)
// checksum.cc, which is compiled to make the shared library
#include <iostream>
extern "C" int get_checksum(char filename[])
{
FILE* fp = fopen(filename, "rb");
if(fp == NULL) {
return 0; // If there is no file, return with a sum of 0.
}
long current, next = 0;
char temp_char = 0;
int sum = 0;
do
{
current = next;
temp_char = fgetc(fp);
next = ftell(fp);
if (temp_char != 10 && temp_char != 13)
sum += (unsigned int)temp_char;
sum %= 100000000; // modulo to prevent memory type overflow
} while (current != next);
fclose(fp);
return sum;
}