You may like to try this C 'readLine' emulation of C++ 'getline' ...
/* CppToC_via_readLine.h.c */
/* using readLine to emulate C++ getline ... */
#include "readLine.h"
/* get copy of file: "readLine.h" at this next link ... */
/*
http://developers-heaven.net/forum/index.php/topic,2580.msg2864.html#msg2864
*/
char encode( char plaintext )
{
if( isupper(plaintext) )
{
if( plaintext > 'M' ) plaintext += 13;
else plaintext -= 13;
}
else if( islower(plaintext) )
{
if( plaintext > 'm' ) plaintext +=13;
else plaintext -=13;
}
return plaintext;
}
int main()
{
char* str;
unsigned i;
printf( "Input string: " ); fflush( stdout );
str = readLine( stdin ); /*free dynamic memory*/
for( i = 0; i < strlen( str ); ++ i )
printf( "%c", encode( str[i] ) );
free( str ); /*now can free dynamic memory*/
printf( "\n\nPress any <ENTER> to exit ... " );
getchar();
return 0;
}