WKern
Loading...
Searching...
No Matches
write.c File Reference
#include <fileio/fileio.h>
#include <io/kio.h>
#include <mem/kmem.h>
#include <types/nums.h>

Go to the source code of this file.

Functions

void Writefile (const char *filename, const char *ext, const char *data, u32 size)
 Write data to an existing file in the FAT16 filesystem.

Function Documentation

◆ Writefile()

void Writefile ( const char * filename,
const char * ext,
const char * data,
u32 size )

Write data to an existing file in the FAT16 filesystem.

Writes data to a FAT16 file, replacing its contents.

Searches for the file specified by filename and extension in the FAT16 root directory. If found, writes up to 512 bytes of data to the file's first cluster sector and updates the file size in the directory entry.

Parameters
filenameThe 8-character filename (without extension).
extThe 3-character file extension.
dataPointer to the data buffer to write.
sizeNumber of bytes to write from the data buffer (max 512 bytes).
Note
This function only writes to the first cluster of the file. Writing beyond the first cluster or appending is not handled.
Assumes the global fat16 structure is properly initialized and accessible.

Definition at line 41 of file write.c.