Click here to Skip to main content
14,579,459 members

C / C++ / MFC

 
GeneralRe: Strange chars Pin
_Flaviu28-Apr-20 21:54
Member_Flaviu28-Apr-20 21:54 
GeneralRe: Strange chars Pin
Member 798912228-Apr-20 22:41
MemberMember 798912228-Apr-20 22:41 
GeneralRe: Strange chars Pin
Richard MacCutchan28-Apr-20 22:47
mveRichard MacCutchan28-Apr-20 22:47 
GeneralRe: Strange chars Pin
_Flaviu29-Apr-20 3:10
Member_Flaviu29-Apr-20 3:10 
GeneralRe: Strange chars Pin
Richard MacCutchan29-Apr-20 3:27
mveRichard MacCutchan29-Apr-20 3:27 
GeneralRe: Strange chars Pin
_Flaviu29-Apr-20 4:25
Member_Flaviu29-Apr-20 4:25 
GeneralRe: Strange chars Pin
Richard MacCutchan29-Apr-20 6:07
mveRichard MacCutchan29-Apr-20 6:07 
GeneralRe: Strange chars Pin
k505429-Apr-20 4:21
mvek505429-Apr-20 4:21 
You have actually identified your problem, you just haven't realized it.
strncpy(dir_strut->directory, "/", sizeof(dir_struct_directory));   //  here name is good
strcat(dir_struct->directory, current_file->name);  // here name is bad
It would seem that current_file->name is not a null terminated C string. You have not given us the details of current_file, or how it is instantiated, so we can't further diagnose the problem at the moment. Perhaps current_file has a member that tells you how long the name member is, in which case you should use that and strncat to append the file name to the directory name.
Keep Calm and Carry On

GeneralRe: Strange chars Pin
_Flaviu29-Apr-20 21:05
Member_Flaviu29-Apr-20 21:05 
GeneralRe: Strange chars Pin
Victor Nijegorodov29-Apr-20 22:38
MemberVictor Nijegorodov29-Apr-20 22:38 
GeneralRe: Strange chars Pin
_Flaviu3-May-20 3:35
Member_Flaviu3-May-20 3:35 
GeneralRe: Strange chars Pin
Victor Nijegorodov3-May-20 4:37
MemberVictor Nijegorodov3-May-20 4:37 
GeneralRe: Strange chars Pin
Richard MacCutchan29-Apr-20 23:25
mveRichard MacCutchan29-Apr-20 23:25 
GeneralRe: Strange chars Pin
_Flaviu29-Apr-20 23:34
Member_Flaviu29-Apr-20 23:34 
GeneralRe: Strange chars Pin
Member 798912229-Apr-20 23:50
MemberMember 798912229-Apr-20 23:50 
GeneralRe: Strange chars Pin
_Flaviu30-Apr-20 2:35
Member_Flaviu30-Apr-20 2:35 
GeneralRe: Strange chars Pin
Richard MacCutchan30-Apr-20 0:04
mveRichard MacCutchan30-Apr-20 0:04 
GeneralRe: Strange chars Pin
_Flaviu30-Apr-20 3:01
Member_Flaviu30-Apr-20 3:01 
GeneralRe: Strange chars Pin
Richard MacCutchan30-Apr-20 3:40
mveRichard MacCutchan30-Apr-20 3:40 
QuestionRe: Strange chars Pin
David Crow30-Apr-20 3:50
MemberDavid Crow30-Apr-20 3:50 
AnswerRe: Strange chars Pin
Richard MacCutchan30-Apr-20 4:02
mveRichard MacCutchan30-Apr-20 4:02 
GeneralRe: Strange chars Pin
Victor Nijegorodov30-Apr-20 5:55
MemberVictor Nijegorodov30-Apr-20 5:55 
GeneralRe: Strange chars Pin
Richard MacCutchan30-Apr-20 6:00
mveRichard MacCutchan30-Apr-20 6:00 
GeneralRe: Strange chars Pin
David Crow30-Apr-20 3:50
MemberDavid Crow30-Apr-20 3:50 
GeneralRe: Strange chars Pin
_Flaviu30-Apr-20 6:09
Member_Flaviu30-Apr-20 6:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.