Skip to content

Instantly share code, notes, and snippets.

@eduardo-cess
eduardo-cess / getTextFromFile.c
Created June 16, 2022 20:36
Function in C to get text from file and put in a variable
#include <stdio.h>
char text[100];
void getTextFromFile(char *filename) {
FILE *fp = fopen(filename, "r");
if (fp == NULL)
{
printf("Error: could not open file %s", filename);