Back to index

texmacs  1.0.7.15
Defines | Functions | Variables
mfileio.h File Reference
#include <stdio.h>
#include "numbers.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define FOPEN_RBIN_MODE   "rb"
#define FOPEN_WBIN_MODE   "wb"
#define MFOPEN(name, mode)   fopen((name),(mode))
#define MFCLOSE(file)   fclose(file)
#define WORK_BUFFER_SIZE   1024

Functions

UNSIGNED_BYTE read_byte (FILE *)
void seek_absolute (FILE *file, long pos)
void seek_relative (FILE *file, long pos)
void seek_end (FILE *file)
long tell_position (FILE *file)
long file_size (FILE *file)
char * mfgets (char *buffer, unsigned long size, FILE *file)

Variables

char work_buffer []

Define Documentation

#define FOPEN_RBIN_MODE   "rb"

Definition at line 33 of file mfileio.h.

#define FOPEN_WBIN_MODE   "wb"

Definition at line 38 of file mfileio.h.

#define MFCLOSE (   file)    fclose(file)

Definition at line 51 of file mfileio.h.

#define MFOPEN (   name,
  mode 
)    fopen((name),(mode))

Definition at line 50 of file mfileio.h.

#define WORK_BUFFER_SIZE   1024

Definition at line 69 of file mfileio.h.


Function Documentation

long file_size ( FILE *  file)

Definition at line 103 of file mfileio.c.

{
  long size;
  /* Seek to end */
  seek_end (file);
  size = tell_position (file);
  rewind (file);
  return (size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* mfgets ( char *  buffer,
unsigned long  size,
FILE *  file 
)

Definition at line 114 of file mfileio.c.

{
  int ch = 0, i = 0;
  while (i < length-1 && (ch = fgetc (file)) >= 0 && ch != '\n' && ch != '\r')
    buffer[i++] = ch;
  buffer[i] = 0;
  if (ch < 0 && i == 0)
    return NULL;
  if (ch == '\r' && (ch = fgetc (file)) >= 0 && (ch != '\n'))
    ungetc (ch, file);
  return buffer;
}

Here is the call graph for this function:

Here is the caller graph for this function:

UNSIGNED_BYTE read_byte ( FILE *  )
void seek_absolute ( FILE *  file,
long  pos 
)

Definition at line 72 of file mfileio.c.

{
  if (fseek(file, pos, SEEK_SET)) {
    os_error();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void seek_end ( FILE *  file)

Definition at line 87 of file mfileio.c.

{
  if (fseek(file, 0L, SEEK_END)) {
    os_error();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void seek_relative ( FILE *  file,
long  pos 
)

Definition at line 79 of file mfileio.c.

{
  if (fseek(file, pos, SEEK_CUR)) {
    os_error();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

long tell_position ( FILE *  file)

Definition at line 94 of file mfileio.c.

{
  long size;
  if ((size = ftell (file)) < 0) {
    os_error();
  }
  return size;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char work_buffer[]

Definition at line 127 of file mfileio.c.