Hi all, please i’m looking to compile a minimal version of tail.
I installed visual studio 2008 and colibri package. Now i’ve to compile the software but i can’t fine commands like:
lseek or read.
the compiler does’nt recognize library to include like io.h
Any idea?
Hi Alex! Thanks!
I know the functions! I was only trying to use the same LINUX stdlib instructions, now i’ve upgraded the software in these way ( formatted also the computer dyed for a trojan ):
MORE MORE MINIMAL:
// minitail2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#define _FILE_OFFSET_BITS 64
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <winbase.h>
//#include <fcntl.h>
//#include <errno.h>
//#include <unistd.h>
//#include <getopt.h>
#define BUFF_SIZE 10000
FILE *file;
unsigned int lung;
unsigned int nbyter;
char c;
char buff[BUFF_SIZE+1];
int _tmain(int argc, _TCHAR* argv[])
//int _tmain(int argc, unsigned char* argv[])
{
//fprintf( stdout, "numero dei parametri: %d\r\n", argc);
if ( argc != 3 ) {
fprintf( stderr, "Utilizzo errato\r\nCorretto uso:\r\n minitail <numerobyte da inviare> <nomedelfile>");
exit(1);
}
sprintf( buff, "%s", argv[2]);
//sprintf( buff, "param99.txt");
file= fopen(buff, "r");
if ( file == NULL ) {
fprintf(stderr, "errore aprendo il file [%s]\n", buff);
exit (1);
}
// ok aperto correttamente
fseek( file, 0, SEEK_END);
lung = ftell(file);
sprintf( buff, "%s", argv[1]);
nbyter = atol(buff);
//nbyter = 2000l;
fprintf( stdout, "Lunghezza file: %lu byte indietro: %lu \r\n", lung, nbyter);
if ( lung < nbyter ) {
fseek( file, 0, SEEK_SET);
} else {
fseek( file, -nbyter, SEEK_END);
}
//fprintf( stdout, "Nuova posizione file: %lu\r\n", ftell(file));
//WalkWFile(file );
while ( fread( buff, 1, 1, file) > 0 ) {
if ( buff[0] == '\n' ) {
break;
}
}
//printf( "inizio lettura\r\n");
// bene ora leggo le righe
while ( fgets( buff, BUFF_SIZE, file) != NULL ) {
printf( "%s", buff);
}
printf( "\r\n");
fclose( file);
return 0;
}
BUT now the compiler says that is unabled to compile for colibri ARM
alex.tx
November 5, 2021, 11:50pm
4
I tried to compile it and everything went well.