#include<stdio.h>
#include<conio.h>
#include<string>
#include <iostream>
#include<stdlib.h>
#include "convert.h"
using namespace std;
int check(string);
string send(string);
string hr_str;
int main()
{
int result=2,n;
char tt[7];
char h[2],m[2],s[2];
cout<<"\nEnter the Time ";
string colon=":";
while(result !=1)
{
printf("\nHR -> ");
scanf("%s",h);
result= check(h);
}
cout<<"\nMain Fun"<<hr_str;
string t_time;
strcpy (t_time,hr_str);//-----problem is here
getch();
}
int check(string str)
{
char *end_ptr;
long long_var;
int int_var,i=0;
// char buff[2]=" ";
char buff[str.size()];
str.copy(buff,str.size(),0);
long_var = strtol(buff, &end_ptr, 0);
if (ERANGE == errno)
{
puts("number out of range\n");
}
else if (long_var > INT_MAX)
{
printf("%ld too large!\n", long_var);
}
else if (long_var < INT_MIN)
{
printf("%ld too small!\n", long_var);
}
else if (end_ptr == buff)
{
printf("not valid numeric input\n");
return 2;
}
#if 0
else if ('\0' != *end_ptr)
{
printf("extra characters on input line\n");
}
#endif
else
{
int_var = (int)long_var;
printf("The number %d is OK!\n", int_var);
if( int_var>=0 && int_var<=9)
{
std::string str = "0" + stringify( int_var);
printf("\n1 digit");
cout<<"\n"<<str;
send(str);
}
else if( int_var>9 && int_var<24)
{
printf("\n2 digit");
std::string str = stringify( int_var);
cout<<"\n"<<str;
send(str);
}
else if(int_var>23)
{
printf("\nEnter correct value");
return 2;
}
return 1;
}
}
string send(string aaa)
{
hr_str=aaa;
cout<<"\nin Fun"<<hr_str;
}
It gives error
no matching function for call to `strcpy(std::string&, std::string&)'
How to solve it??