Click here to Skip to main content
14,664,617 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Strange chars Pin
Richard Andrew x6428-Apr-20 9:19
professionalRichard Andrew x6428-Apr-20 9:19 
GeneralRe: Strange chars Pin
_Flaviu28-Apr-20 9:40
Member_Flaviu28-Apr-20 9:40 
GeneralRe: Strange chars Pin
Richard Andrew x6428-Apr-20 9:57
professionalRichard Andrew x6428-Apr-20 9:57 
AnswerRe: Strange chars Pin
Richard MacCutchan28-Apr-20 21:32
mveRichard MacCutchan28-Apr-20 21:32 
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 
#define DIR_NAME_LEN 2048

struct dir_struct
	{
		void* display;
		char directory[DIR_NAME_LEN];
...
....


I have followed the way of how this variable is handled:

dir_struct_t dir_struct;

	TRACE(_T("Directory - %s\n"), dir_struct.directory); -> _CrtDbgReport: String too long or IO Error

	strncpy(dir_struct->directory, "/", sizeof(dir_struct->directory));	

	TRACE(_T("Directory - %s\n"), dir_struct->directory);	-> /

	strcat(dir_struct->directory, current_file->name);
	
	TRACE(_T("Directory - %s\n"), dir_struct->directory);	-> _CrtDbgReport: String too long or IO Error

And if I look into VS debugger when I got "_CrtDbgReport: String too long or IO Error" from TRACE macro, I see the following result: see image.[^] and Untitled2 — Postimage.org[^]

The line strcat(dir_struct->directory, current_file->name); is not quite correct ? I mean, correct for Windows, even if is correct for Linux ...
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 
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 

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.