O
Oodini
Hello,
I've got some troubles by using sprintf on gcc.
Here is a sample program:
----------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
FILE *outfile;
char *string1, *string2;
float value=3.74;
string1 = "turlutu\r\n";
if ((outfile = fopen("postscript.ps","w")) == NULL)
printf("Ksssss !!");
printf("%f",value);
// sprintf(string2,"%f",value);
fputs(string1,outfile);
fclose(outfile);
}
----------------------------------------------------------------
As soon as I uncomment sprintf, I got an error at the runtime (no
problem during the compilation):
4 [main] a 1796 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
18482 [main] a 1796 open_stackdumpfile: Dumping stack trace to
a.exe.stackdump
Compiled on gcc 3.2 2002/09/27
Ran on Windows 2000 SP3
Below is the stack dump...
Exception: STATUS_ACCESS_VIOLATION at eip=610B73CF
eax=61009E03 ebx=0A040498 ecx=00000001 edx=0022FE30 esi=0A040498
edi=61009E03
ebp=0022E908 esp=0022E8FC program=G:\oodini\Moteurs de
rendu\zob\libsipp\a.exe
cs=001B ds=0023 es=0023 fs=0038 gs=0000 ss=0023
Stack trace:
Frame Function Args
0022E908 610B73CF (61009E03, 0A040498, 00000001, 00000003)
0022E948 610C5A20 (0022FE30, 0022FDA0, 00000000, 00000001)
0022E968 610BF602 (0022FE30, 0022FDA0, EF5C2900, 00004000)
0022FDF8 610BFF21 (610CB050, 0022FE30, 004010B4, 0022FEC0)
0022FE18 610BF70C (0022FE30, 004010B4, 0022FEB8, 00000000)
0022FEA8 610B91AD (61009E03, 004010B4, 20000000, 400DEB85)
0022FEE0 0040113A (00000001, 0A0403D8, 0A040328, 00000001)
0022FF40 61007408 (610D1F58, FFFFFFFE, 0000002C, 610D1E7C)
0022FF90 610076ED (00000000, 00000000, 8042F070, 00000000)
0022FFB0 00402722 (004010B8, 037F0009, 0022FFF0, 77E9847C)
0022FFC0 0040103C (00000000, 00000000, 7FFDF000, 00000000)
0022FFF0 77E9847C (00401000, 00000000, 000000C8, 00000100)
End of stack trace
I've got some troubles by using sprintf on gcc.
Here is a sample program:
----------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
FILE *outfile;
char *string1, *string2;
float value=3.74;
string1 = "turlutu\r\n";
if ((outfile = fopen("postscript.ps","w")) == NULL)
printf("Ksssss !!");
printf("%f",value);
// sprintf(string2,"%f",value);
fputs(string1,outfile);
fclose(outfile);
}
----------------------------------------------------------------
As soon as I uncomment sprintf, I got an error at the runtime (no
problem during the compilation):
4 [main] a 1796 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
18482 [main] a 1796 open_stackdumpfile: Dumping stack trace to
a.exe.stackdump
Compiled on gcc 3.2 2002/09/27
Ran on Windows 2000 SP3
Below is the stack dump...
Exception: STATUS_ACCESS_VIOLATION at eip=610B73CF
eax=61009E03 ebx=0A040498 ecx=00000001 edx=0022FE30 esi=0A040498
edi=61009E03
ebp=0022E908 esp=0022E8FC program=G:\oodini\Moteurs de
rendu\zob\libsipp\a.exe
cs=001B ds=0023 es=0023 fs=0038 gs=0000 ss=0023
Stack trace:
Frame Function Args
0022E908 610B73CF (61009E03, 0A040498, 00000001, 00000003)
0022E948 610C5A20 (0022FE30, 0022FDA0, 00000000, 00000001)
0022E968 610BF602 (0022FE30, 0022FDA0, EF5C2900, 00004000)
0022FDF8 610BFF21 (610CB050, 0022FE30, 004010B4, 0022FEC0)
0022FE18 610BF70C (0022FE30, 004010B4, 0022FEB8, 00000000)
0022FEA8 610B91AD (61009E03, 004010B4, 20000000, 400DEB85)
0022FEE0 0040113A (00000001, 0A0403D8, 0A040328, 00000001)
0022FF40 61007408 (610D1F58, FFFFFFFE, 0000002C, 610D1E7C)
0022FF90 610076ED (00000000, 00000000, 8042F070, 00000000)
0022FFB0 00402722 (004010B8, 037F0009, 0022FFF0, 77E9847C)
0022FFC0 0040103C (00000000, 00000000, 7FFDF000, 00000000)
0022FFF0 77E9847C (00401000, 00000000, 000000C8, 00000100)
End of stack trace