Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!s3!lamarche From: lamarche@ireq.hydro.qc.ca Newsgroups: comp.unix.aux Subject: Problem in sscanf with gcc-1.37 ? Keywords: sscanf gcc Message-ID: <2204@s3.ireq.hydro.qc.ca> Date: 27 Jul 90 03:40:27 GMT Sender: root@s3.ireq.hydro.qc.ca Reply-To: lamarche@ireq.hydro.qc.ca () Organization: IREQ, Hydro-Quebec Lines: 36 The following problem arrived when I tried to compile Dclock (X11R4 client, comp.sources.x). Here is a short program that describe it. #include main () { char works[] = "Works 1 2"; char* fails = "Fails 1 2"; int d1,d2; printf ( "String: %s ", works ); fflush(stdout); sscanf ( works, "Works %1d %1d", &d1, &d2 ); printf ( "--> Read: %d %d\n", d1, d2 ); printf ( "String: %s ", fails ); fflush(stdout); sscanf ( fails, "Fails %1d %1d", &d1, &d2 ); printf ( "--> Read: %d %d\n", d1, d2 ); } That gives the following output: String: Works 1 2 --> Read: 1 2 String: Fails 1 2 Memory fault - core dumped Conclusion: We can printf but we can't sscanf it. Since this program works with cc, is this behavior normal with gcc ? -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Louis Lamarche, IREQ | lamarche@ireq.hydro.qc.ca | CP 1000, Varennes | or | QC, Canada, J3X 1S1 | 514-652-8077 (office) 514-324-2919 (home)