|
file_str_read crashes with '#' character
#420034
03/18/13 20:03
03/18/13 20:03
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
OP
Expert
|
OP
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Hello jcl, file_str_read produces a crash if the very first character in a file is '#'. Here are the steps necessary to reproduce the problem. First create a file test.txt with content like this: If you then execute the following snippet the engine will crash.
#include <acknex.h>
void main()
{
var h = file_open_read("test.txt");
if (h)
{
STRING* s = str_create("#128");
file_str_read(h,s);
printf("The content is:\n%s\nThe length is:\n%d",s->chars,(int)str_len(s));
file_close(h);
}
}
Best regards, Uhrwerk
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: file_str_read crashes with '#' character
[Re: Uhrwerk]
#420070
03/19/13 12:09
03/19/13 12:09
|
Joined: Feb 2012
Posts: 371
Dico
Senior Member
|
Senior Member
Joined: Feb 2012
Posts: 371
|
Hello jcl, file_str_read produces a crash if the very first character in a file is '#'. Here are the steps necessary to reproduce the problem. First create a file test.txt with content like this: If you then execute the following snippet the engine will crash.
#include <acknex.h>
void main()
{
var h = file_open_read("test.txt");
if (h)
{
STRING* s = str_create("#128");
file_str_read(h,s);
printf("The content is:\n%s\nThe length is:\n%d",s->chars,(int)str_len(s));
file_close(h);
}
}
Best regards, Uhrwerk the problem is not in file_str_read but in printf
|
|
|
Re: file_str_read crashes with '#' character
[Re: 3run]
#420083
03/19/13 15:04
03/19/13 15:04
|
Joined: Feb 2012
Posts: 371
Dico
Senior Member
|
Senior Member
Joined: Feb 2012
Posts: 371
|
the problem is not in file_str_read but in printf Use any other draw function f.e. debug_var or draw_text, and you'll see that bug is still there but i test it with TEXT and it work nice without any problem . but when i use printf the engine crash
|
|
|
Re: file_str_read crashes with '#' character
[Re: 3run]
#420084
03/19/13 15:11
03/19/13 15:11
|
Joined: Feb 2012
Posts: 371
Dico
Senior Member
|
Senior Member
Joined: Feb 2012
Posts: 371
|
the problem is not in file_str_read but in printf Use any other draw function f.e. debug_var or draw_text, and you'll see that bug is still there try this
#include <acknex.h>
STRING* str_show = "";
TEXT* txt_d =
{
string = str_show;
pos_y = 200;
flags = SHOW;
}
void main()
{
var h = file_open_read("test.txt");
if (h)
{
STRING* s = str_create("#128");
file_str_read(h,s);
//printf("The content is:\n%s\nThe length is:\n%d",s->chars,(int)str_len(s));
str_cpy(str_show,s);
file_close(h);
}
}
there is no crash
|
|
|
Re: file_str_read crashes with '#' character
[Re: Dico]
#420104
03/19/13 18:23
03/19/13 18:23
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
OP
Expert
|
OP
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
It is correct that your sample does not crash. But it does not set the string read to the correct contents from the file and takes ages to execute. So the bug is clearly related to file_str_read.
Please don't triple post.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: file_str_read crashes with '#' character
[Re: jcl]
#420180
03/20/13 21:42
03/20/13 21:42
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
OP
Expert
|
OP
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Well, on my machine the sample I posted above does crash. Maybe this is of any help to you:
Source
acknex.exe
Summary
Stopped working
Date
‎3/‎20/‎2013 10:39 PM
Status
Report sent
Description
Faulting Application Path: D:\Program Files (x86)\GStudio8\acknex.exe
Problem signature
Problem Event Name: BEX
Application Name: acknex.exe
Application Version: 0.0.0.0
Application Timestamp: 4c1231af
Fault Module Name: StackHash_e98d
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Offset: 20202020
Exception Code: c0000005
Exception Data: 00000008
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: e98d
Additional Information 2: e98dfca8bcf81bc1740adb135579ad53
Additional Information 3: 6eab
Additional Information 4: 6eabdd9e0dc94904be3b39a1c0583635
Extra information about the problem
Bucket ID: 2589014125
Always learn from history, to be sure you make the same mistakes again...
|
|
|
|