I wrote the following piece of code to check the use of strcpy_s function. Program got compiled successfully but there was no output(printed blank). I am currently using gcc version 4.8.5 on Red Hat 4.8.5-4 linux.
#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include<iostream>
using namespace std;
int main( void )
{
char bar[40];
memset(bar,'\0',40);
#ifdef __STDC_LIB_EXT1__
strcpy_s(bar, 40,"A string longer than 9 chars");
#endif
std::cout<<"strcpy_s output is "<<bar<<std::endl;
return 0;
}
Also when I checked whether the system supported c++11 feature , I guess it does not. I used the following code to determine it.
#include <iostream>
int main(){
#if __cplusplus==201402L
std::cout << "C++14" << std::endl;
#elif __cplusplus==201103L
std::cout << "C++11" << std::endl;
#else
std::cout << "C++" << std::endl;
#endif
std::cout<<"__cplusplus value is "<< __cplusplus <<std::endl;
return 0;
}
Output was C++ __cplusplus value is 199711
Can someone please help how to enable c++11 feature .
Aucun commentaire:
Enregistrer un commentaire