digitalmars.D.bugs - broken stream.readLine in dmd 0.89
- Ivan Senji (22/22) May 19 2004 When using readLine i get Error: Access Violation
- Ben Hinkle (15/37) May 19 2004 I don't see any difference in the output. Can you post the results you g...
- Ivan Senji (11/54) May 20 2004 get?
- Ben Hinkle (3/18) May 20 2004 are you on Windows or Linux? I've tested on RedHat 9 and Windows XP.
- Ivan Senji (8/26) May 20 2004 readLine()
- Ivan Senji (5/23) May 20 2004 readLine()
- J C Calvarese (41/73) May 19 2004 After I removed an extraneous "}" from your example, it worked fine for
- Ivan Senji (4/77) May 20 2004 I would have also added \n if i got any output at all :)
- Andrew Edwards (25/42) May 20 2004 No Access Violation here (DMD v0.89/WinXP): the only thing wrong with it...
- Ivan Senji (3/25) May 21 2004 I am very happy to say this works now in 0.90 :)
When using readLine i get Error: Access Violation This started with 0.89 and everything works ok in 0.88 Example code: <CODE file="testreadLine.d"> import std.c.stdio; import std.stream; int main (char [] [] args ) { File file = new File("testreadLine.d"); char[] line; do { line = file.readLine(); printf("Line: %.*s",line); }while(!file.eof); } getch(); return 1; } </CODE> All my code uses readLine so now nothing of that code works and i don't like having to use files from different versions!
May 19 2004
I don't see any difference in the output. Can you post the results you get? Line: import std.c.stdio;Line: import std.stream;Line: Line: int main() {Line: F ile file = new File("rt.d");Line: Line: char[] line;Line: Line: doLine: {Line : line = file.readLine();Line: printf("Line: .*s",line);Line: }while(!file .eof);Line: Line: getch();Line: return 0;Line: } The std.stream.readLine did change to call char[] readLine(char[] buffer) which will fill the supplied buffer if the line fits so that there is less memory allocation. -Ben "Ivan Senji" <ivan.senji public.srce.hr> wrote in message news:c8gk70$das$1 digitaldaemon.com...When using readLine i get Error: Access Violation This started with 0.89 and everything works ok in 0.88 Example code: <CODE file="testreadLine.d"> import std.c.stdio; import std.stream; int main (char [] [] args ) { File file = new File("testreadLine.d"); char[] line; do { line = file.readLine(); printf("Line: %.*s",line); }while(!file.eof); } getch(); return 1; } </CODE> All my code uses readLine so now nothing of that code works and i don't like having to use files from different versions!
May 19 2004
"Ben Hinkle" <bhinkle mathworks.com> wrote in message news:c8gm40$m06$1 digitaldaemon.com...I don't see any difference in the output. Can you post the results youget? Very strange! The difference is with the new stream.d version i don't get any output! I get "Error: Access Violation" the first time readLine() is called. I tried "printf("%.*s",file.toString());" and this prints the entire file but it isn't what i need. I don't know why is it working for you? I tested four of my projects that use FIle.readLine() an none of them work and they all crash at readLine()!Line: import std.c.stdio;Line: import std.stream;Line: Line: int main() {Line: F ile file = new File("rt.d");Line: Line: char[] line;Line: Line: doLine: {Line : line = file.readLine();Line: printf("Line: .*s",line);Line: }while(!file .eof);Line: Line: getch();Line: return 0;Line: } The std.stream.readLine did change to call char[] readLine(char[] buffer) which will fill the supplied buffer if the line fits so that there is less memory allocation. -Ben "Ivan Senji" <ivan.senji public.srce.hr> wrote in message news:c8gk70$das$1 digitaldaemon.com...When using readLine i get Error: Access Violation This started with 0.89 and everything works ok in 0.88 Example code: <CODE file="testreadLine.d"> import std.c.stdio; import std.stream; int main (char [] [] args ) { File file = new File("testreadLine.d"); char[] line; do { line = file.readLine(); printf("Line: %.*s",line); }while(!file.eof); } getch(); return 1; } </CODE> All my code uses readLine so now nothing of that code works and i don't like having to use files from different versions!
May 20 2004
Ivan Senji wrote:"Ben Hinkle" <bhinkle mathworks.com> wrote in message news:c8gm40$m06$1 digitaldaemon.com...are you on Windows or Linux? I've tested on RedHat 9 and Windows XP. -BenI don't see any difference in the output. Can you post the results youget? Very strange! The difference is with the new stream.d version i don't get any output! I get "Error: Access Violation" the first time readLine() is called. I tried "printf("%.*s",file.toString());" and this prints the entire file but it isn't what i need. I don't know why is it working for you? I tested four of my projects that use FIle.readLine() an none of them work and they all crash at readLine()!
May 20 2004
"Ben Hinkle" <bhinkle4 juno.com> wrote in message news:c8i048$2o8e$1 digitaldaemon.com...Ivan Senji wrote:readLine()"Ben Hinkle" <bhinkle mathworks.com> wrote in message news:c8gm40$m06$1 digitaldaemon.com...I don't see any difference in the output. Can you post the results youget? Very strange! The difference is with the new stream.d version i don't get any output! I get "Error: Access Violation" the first timefileis called. I tried "printf("%.*s",file.toString());" and this prints the entireWindows XP. Later i'll test it on an other computer, and let you know how that turns out. Thanks for testing this, it seams that it only doesn't work on my computer.but it isn't what i need. I don't know why is it working for you? I tested four of my projects that use FIle.readLine() an none of them work and they all crash at readLine()!are you on Windows or Linux? I've tested on RedHat 9 and Windows XP.-Ben
May 20 2004
"Ben Hinkle" <bhinkle4 juno.com> wrote in message news:c8i048$2o8e$1 digitaldaemon.com...Ivan Senji wrote:readLine()"Ben Hinkle" <bhinkle mathworks.com> wrote in message news:c8gm40$m06$1 digitaldaemon.com...I don't see any difference in the output. Can you post the results youget? Very strange! The difference is with the new stream.d version i don't get any output! I get "Error: Access Violation" the first timefileis called. I tried "printf("%.*s",file.toString());" and this prints the entireI just tested it on the other computer (WinXP) and i get the same error.but it isn't what i need. I don't know why is it working for you? I tested four of my projects that use FIle.readLine() an none of them work and they all crash at readLine()!are you on Windows or Linux? I've tested on RedHat 9 and Windows XP.-Ben
May 20 2004
Ivan Senji wrote:When using readLine i get Error: Access Violation This started with 0.89 and everything works ok in 0.88After I removed an extraneous "}" from your example, it worked fine for me on (DMD 0.89/WinXP HE). I don't know why you're getting an Access Violation. (I also added an "\n" to make the output more readable.) import std.c.stdio; import std.stream; int main (char [] [] args ) { File file = new File("testreadLine.d"); char[] line; do { line = file.readLine(); printf("Line: %.*s\n",line); }while(!file.eof); getch(); return 1; } Output... Line: import std.c.stdio; Line: import std.stream; Line: Line: int main (char [] [] args ) Line: { Line: File file = new File("testreadLine.d"); Line: Line: char[] line; Line: Line: do Line: { Line: line = file.readLine(); Line: printf("Line: %.*s\n",line); Line: }while(!file.eof); Line: Line: Line: getch(); Line: return 1; Line: }Example code: <CODE file="testreadLine.d"> import std.c.stdio; import std.stream; int main (char [] [] args ) { File file = new File("testreadLine.d"); char[] line; do { line = file.readLine(); printf("Line: %.*s",line); }while(!file.eof); } getch(); return 1; } </CODE> All my code uses readLine so now nothing of that code works and i don't like having to use files from different versions!-- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
May 19 2004
"J C Calvarese" <jcc7 cox.net> wrote in message news:c8gq41$v3u$1 digitaldaemon.com...Ivan Senji wrote:I would have also added \n if i got any output at all :) I gues i will temporarilly have to go back to the old stream.d :(When using readLine i get Error: Access Violation This started with 0.89 and everything works ok in 0.88After I removed an extraneous "}" from your example, it worked fine for me on (DMD 0.89/WinXP HE). I don't know why you're getting an Access Violation. (I also added an "\n" to make the output more readable.)import std.c.stdio; import std.stream; int main (char [] [] args ) { File file = new File("testreadLine.d"); char[] line; do { line = file.readLine(); printf("Line: %.*s\n",line); }while(!file.eof); getch(); return 1; } Output... Line: import std.c.stdio; Line: import std.stream; Line: Line: int main (char [] [] args ) Line: { Line: File file = new File("testreadLine.d"); Line: Line: char[] line; Line: Line: do Line: { Line: line = file.readLine(); Line: printf("Line: %.*s\n",line); Line: }while(!file.eof); Line: Line: Line: getch(); Line: return 1; Line: }Example code: <CODE file="testreadLine.d"> import std.c.stdio; import std.stream; int main (char [] [] args ) { File file = new File("testreadLine.d"); char[] line; do { line = file.readLine(); printf("Line: %.*s",line); }while(!file.eof); } getch(); return 1; } </CODE> All my code uses readLine so now nothing of that code works and i don't like having to use files from different versions!-- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
May 20 2004
Ivan Senji wrote:"J C Calvarese" <jcc7 cox.net> wrote in message news:c8gq41$v3u$1 digitaldaemon.com...No Access Violation here (DMD v0.89/WinXP): the only thing wrong with it is the extra '}'. Remove it and the program works fine. F:\>dmd testreadLine f:\dmd\bin\..\..\dm\bin\link.exe testreadLine,,,user32+kernel32/noi; F:\>testreadLine Line: import std.c.stdio; Line: import std.stream; Line: Line: int main (char [] [] args ) Line: { Line: File file = new File("testreadLine.d"); Line: Line: char[] line; Line: Line: do Line: { Line: line = file.readLine(); Line: printf("Line: %.*s\n",line); // added \n Line: }while(!file.eof); Line: //} <== remove this and recompile! Line: Line: getch(); Line: return 1; Line: }Ivan Senji wrote:I would have also added \n if i got any output at all :) I gues i will temporarilly have to go back to the old stream.d :(When using readLine i get Error: Access Violation This started with 0.89 and everything works ok in 0.88After I removed an extraneous "}" from your example, it worked fine for me on (DMD 0.89/WinXP HE). I don't know why you're getting an Access Violation. (I also added an "\n" to make the output more readable.)
May 20 2004
"Ivan Senji" <ivan.senji public.srce.hr> wrote in message news:c8gk70$das$1 digitaldaemon.com...When using readLine i get Error: Access Violation This started with 0.89 and everything works ok in 0.88 Example code: <CODE file="testreadLine.d"> import std.c.stdio; import std.stream; int main (char [] [] args ) { File file = new File("testreadLine.d"); char[] line; do { line = file.readLine(); printf("Line: %.*s",line); }while(!file.eof); } getch(); return 1; } </CODE> All my code uses readLine so now nothing of that code works and i don't like having to use files from different versions!I am very happy to say this works now in 0.90 :)
May 21 2004