Click here to Skip to main content
15,880,405 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Strange chars Pin
_Flaviu28-Apr-20 21:54
_Flaviu28-Apr-20 21:54 
GeneralRe: Strange chars Pin
kalberts28-Apr-20 22:41
kalberts28-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
_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
_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.
C++
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
_Flaviu29-Apr-20 21:05 
GeneralRe: Strange chars Pin
Victor Nijegorodov29-Apr-20 22:38
Victor Nijegorodov29-Apr-20 22:38 
GeneralRe: Strange chars Pin
_Flaviu3-May-20 3:35
_Flaviu3-May-20 3:35 
GeneralRe: Strange chars Pin
Victor Nijegorodov3-May-20 4:37
Victor 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
_Flaviu29-Apr-20 23:34 
GeneralRe: Strange chars Pin
kalberts29-Apr-20 23:50
kalberts29-Apr-20 23:50 
GeneralRe: Strange chars Pin
_Flaviu30-Apr-20 2:35
_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
_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
David 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
Victor 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
David Crow30-Apr-20 3:50 
GeneralRe: Strange chars Pin
_Flaviu30-Apr-20 6:09
_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.