Home » U++ Library support » U++ Core » strcpy issue
strcpy issue [message #46726] |
Wed, 20 July 2016 17:44  |
 |
forlano
Messages: 1207 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
the following code involving a silly STRCPY crash my application in release mode (upp 9994, 64 bit, gcc , c++11, lubuntu 16.04)
class Team : Moveable<Team> {
public:
...
char hstatus[50];
...
Team();
~Team(){;}
};
......
sql.Execute("SELECT * FROM TEAMS order by N");
while(sql.Fetch()) {
Team& t = VTeam.Add( (int)sql[N] );
...
strcpy (t.hstatus, (String) sql[HSTATUS] ); //<=== crash!
...
}
instead works in debug mode.
On windows, 32 bit, old upp no c++11, it works too.
hstatus cannot be a String (I need to modify its content char by char when needed).
What is wrong in that innocent line?
Thanks,
Luigi
|
|
|
|
|
|
Re: strcpy issue [message #46738 is a reply to message #46737] |
Thu, 21 July 2016 13:37  |
|
forlano wrote on Thu, 21 July 2016 12:54
String s = "0000000000000000000000";
s[4] = '1';
Is there a way to do it?
This should work:
String s = "0000000000000000000000";
s.Set(4, '1');
Honza
|
|
|
Goto Forum:
Current Time: Sat Apr 26 21:55:59 CEST 2025
Total time taken to generate the page: 0.00946 seconds
|