How to create shared library in Linux invironment.
password.hh
#ifndef PASSWORD_HHH
#define PASSWORD_HHH
#include <stdio.h>
#include <stdlib.h>
static char pas[50];
char* password (void);
#endif
password.cpp
// I specially didn't use C++ libraries for
// the compatibility with C compiler
#include "password.hh"
char* password (void)
{
char file[50];
FILE *in;
sprintf(file,"%s/.password", getenv("HOME"));
if ( (in = fopen(file,"r")) == NULL )
{
printf("You must create file .password");
printf(" in you home directory\n");
exit(EXIT_FAILURE);
}
fscanf(in,"%s",pas);
fclose(in);
return pas;
}