This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re[2]: Sprintf issue
- From: Pavel Tsekov <ptsekov at syntrex dot com>
- To: Jorge Goncalvez <goncal11 at col dot bsf dot alcatel dot fr>
- Cc: cygwin at cygwin dot com
- Date: Mon, 18 Feb 2002 15:08:42 +0100
- Subject: Re[2]: Sprintf issue
- Organization: Syntrex, Inc.
- References: <200202181025.LAA19208@cabs40.col.bsf.alcatel.fr>
- Reply-to: Pavel Tsekov <cygwin at cygwin dot com>
Hello Jorge,
Please, can you check the return value of the system () call ? Also
are you trying to run the compiled program from the cygwin shell or
from the windows command prompt ? Output of cygcheck -r -s -v would
be vuseful too. This is a problem which was brought to the mailing
list some time ago though solution was not found then.
Monday, February 18, 2002, 11:25:09 AM, you wrote:
JG> Hi, i tried to modified a C program running on linux and make it running on
JG> windows with gcc for cygwin:
JG> like this:
JG> sprintf(arpbuf, "arp -s %s `echo %s | sed -e s/:/-/g`"
JG> piaddr (lease -> ip_addr),
JG> print_hw_addr (lease -> hardware_addr.htype,
JG> lease -> hardware_addr.hlen,
JG> lease -> hardware_addr.haddr));
JG> note(arpbuf);
JG> system(arpbuf);
JG> }
JG> and the original was:
JG> sprintf(arpbuf, "arp -s %s %s ",
JG> piaddr (lease -> ip_addr),
JG> print_hw_addr (lease -> hardware_addr.htype,
JG> lease -> hardware_addr.hlen,
JG> lease -> hardware_addr.haddr));
JG> note(arpbuf);
JG> system(arpbuf);
JG> }
JG> but my second %s was with the following format XX:XX:XX:XX:XX:XX and i would
JG> replace it by XX-XX-XX-XX-XX-XX.
JG> I tried sed but it didn't work.Why? it seem not to be interpreted I have :
JG> arp -s 192.40.54.42 `echo 00:80:9f:2e:3f:5e | sed -e s/:/-/g`
JG> Could i do it in pure C?Thanks for your precious help.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/