post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
Defines | Functions
/home/travis/build/hasufell/pqc/src/ntru_file.c File Reference

file operations More...

#include "ntru_common.h"
#include "ntru_err.h"
#include "ntru_mem.h"
#include "ntru_string.h"
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Include dependency graph for ntru_file.c:

Go to the source code of this file.

Defines

#define STD_FILE_BUF   4096

Functions

stringread_file (char const *const filename)
bool write_file (string const *wstring, char const *const filename)

Detailed Description

file operations

Allows operations on files, such as reading and writing.

Definition in file ntru_file.c.


Define Documentation

#define STD_FILE_BUF   4096

Definition at line 44 of file ntru_file.c.


Function Documentation

string* read_file ( char const *const  filename)

Reads a file and returns a newly allocated string.

Parameters:
filenamefile to open
Returns:
a newly allocated string which must be freed by the caller or NULL on failure (e.g. if the file could not be opened/closed)

Definition at line 50 of file ntru_file.c.

bool write_file ( string const *  wstring,
char const *const  filename 
)

Write a string to a file. The file will be pruned or created if it does not exist.

Parameters:
wstringthe string to write to the file
filenamethe name of the file to write to
Returns:
true for success or false for failure if fopen or fclose failed

Definition at line 107 of file ntru_file.c.

 All Data Structures Files Functions Variables Typedefs Defines