xtralib  0.1.0
A simple header-based drop-in library
Macros | Typedefs | Functions | Variables
io.h File Reference

New functions related to file handling and writing to stdout. More...

#include "common.h"
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <wchar.h>
#include <unistd.h>
#include <sys/shm.h>
#include <string.h>
#include <ctype.h>

Go to the source code of this file.

Macros

#define ANSI_RED   "\x1b[31m"
 
#define ANSI_GREEN   "\x1b[32m"
 
#define ANSI_YELLOW   "\x1b[33m"
 
#define ANSI_BLUE   "\x1b[34m"
 
#define ANSI_MAGENTA   "\x1b[35m"
 
#define ANSI_CYAN   "\x1b[36m"
 
#define ASNI_WHITE   "\x1b[37m"
 
#define ANSI_RESET   "\x1b[0m"
 
#define CHECK_PRINTF_FMT(...)
 

Typedefs

typedef uint8_t u8
 

Functions

char fpeek (FILE *stream)
 View the next character in stream, doesn't move pointer. More...
 
wchar_t fpeek_wc (FILE *stream)
 Same as fpeek but for wchar_t.
 
char fspeek (FILE *stream, long int offset, int position)
 View a character at position without moving pointer; Peeks a seek. More...
 
int frpeek (FILE *stream, char c)
 A recursive peek that goes to end of line or EOF to get # of occurences.
 
int frdpeek (FILE *stream, char d)
 A recursive peek that goes till the delimter d.
 
int fcounts (FILE *stream)
 Character count of current line of buffer.
 
int fcopy (FILE *dest, FILE *src)
 Copies data from src file tp dest file.
 
int fexists (const char *file)
 
int fmove (const char *oldpath, char *newpath)
 
void sgets (char *str, int n)
 
bool promptYesOrNo (const char *question)
 
void printb (void const *const ptr)
 
 CHECK_PRINTF_FMT (1, 2) void eprintf(const char *fmt
 
 CHECK_PRINTF_FMT (1, 3) void cprintf(const char *color
 

Variables

const char * fmt
 

Detailed Description

New functions related to file handling and writing to stdout.

Author
yung-turabian
Date
4 6 2024

Function Documentation

◆ fpeek()

char fpeek ( FILE *  stream)

View the next character in stream, doesn't move pointer.

Returns
character.

◆ fspeek()

char fspeek ( FILE *  stream,
long int  offset,
int  position 
)

View a character at position without moving pointer; Peeks a seek.

Returns
seeked and peeked character.