Skip to contentSkip to conversation

sprintf with mips

DISCUSSION Christian Stalp 2 participants 2 messages Feb 6, 2008 – Feb 7, 2008

lore
Share & tools
lore
#0 lore raw

the second printf is only for debugging purpose. The whole string 'insertvalues' is used for SQL-query later.

Quoted 14 lines · Eric Polino

On Feb 6, 2008 2:16 PM, Christian Stalp <[email protected]> wrote:

Hello out there,
are there any known problems with sprintf under mips? I spend some time to make this code runnable:

sprintf(insertvalues, " %d , ' %s ' , %d ", counter, "192.168.1.1", mytraffic->num_frames); printf("input-string: %s\n", insertvalues);

I don't know if this really matters...but why are you doing this this way? Why not just do it in one line with

printf("input-string: %d , ' %s ' , %d \n", counter, "192.168.1.1", mytraffic->num_frames);

Signature · 2 lines
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
#1 lore raw
Quoted 1 line

are there any known problems with sprintf under mips?

Is there any chance that some other line of code, perhaps writing an adjacent variable, is overflowing onto the front of this insertvalues[] array, between the sprintf and the printf?

In other words, I'll wager that whatever bug you're seeing is neither in the code fragements quoted here, nor in the sprintf libc code, but in some other nearby code.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.940.382.4214