Skip to contentSkip to conversation

sprintf with mips

DISCUSSION Christian Stalp 3 participants 3 messages Feb 6, 2008

lore
Share & tools
lore
#0 lore raw

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);

This works properly under x86 but if I run this under mips, the string is empty! Even if the variable 'counter' is uninitialized or 'mytraffic->num_frames' (which is not the case, I can see the values if I dump them directly with printf) there should be at least that IP-address-string which should be inserted! This is weired. Has anybody an idea what the problem is here?

Thank you.

Gruss Christian

Signature · 2 lines
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
#1 lore raw

How is insertvalues defined?

Gary

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Christian Stalp
Sent: Wednesday, February 06, 2008 11:16 AM
To: [email protected]
Subject: sprintf with mips

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);

This works properly under x86 but if I run this under mips, the string is empty! Even if the variable 'counter' is uninitialized or 'mytraffic->num_frames' (which is not the case, I can see the values if I dump them directly with printf) there should be at least that IP-address-string which should be inserted! This is weired. Has anybody an idea what the problem is here?

Thank you.

Gruss Christian

#2 lore raw
In reply to Christian Stalp
Quoted 6 lines · Christian Stalp

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);

Cheers,
Eric

Quoted 15 lines

This works properly under x86 but if I run this under mips, the string is empty! Even if the variable 'counter' is uninitialized or 'mytraffic->num_frames' (which is not the case, I can see the values if I dump them directly with printf) there should be at least that IP-address-string which should be inserted! This is weired. Has anybody an idea what the problem is here?

Thank you.

Gruss Christian

--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
"None are more hopelessly enslaved than those who falsely believe they
are free."
                                      --Goethe

"Freedom is living without government coercion."
                   --Ron Paul (www.ronpaul2008.com)