printf/scanf trouble on SPARCstation 
Author Message
 printf/scanf trouble on SPARCstation

The following problem completely beats me. I'm also rather new to
SPARCstations, and my knowledge of SPARC assembly language (ugh) is virtually
zero:

I have a large program (object size ~1/2 MB) that wants to read and write
things from/to files. However, whenever it tries to do so a segmentation fault
occurs. I have traced the error to a routine called `_doprnt()' which appears
to be a subroutine of `fprintf()'. Specifically, the error occurs at the
instruction
                _doprnt+0x24:   ld      [%o0], %o0

where, it seems, the machine wants to dereference a NULL pointer; at least
%o0 is 0 at that point.

The problem does not occur when the program in question is small (~25 KB).
Also, when I substitute `fputs()' for `fprintf()' at this point, it goes past
there O.K. but bombs when it hits a `fscanf()' later on. When I use `sprintf()'
and `fputs()' in place of `fprintf()' the thing dies, too.

The code is known to work on other UNIX machines; we're running SunOS 4.1 on
a SPARCstation 1+ and the `native' C compiler.


- Anselm.



Sun, 07 Feb 1993 16:59:28 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. questions about sprintf, sscanf, printf, scanf, fscanf, fprintf!

2. Simple scanf/printf question

3. skipped printf/scanf ???

4. tiny question on format of scanf and printf

5. Examples of format strings for scanf/printf ?

6. scanf/printf conversions

7. pointers in scanf and printf

8. Beginner question - printf and scanf

9. printf() and scanf()

10. casting printf/scanf

11. Q:printf() and scanf()....

12. printf and scanf in IBMC on IBM 3090

 

 
Powered by phpBB® Forum Software