snprinf

This is a discussion on snprinf within the PHP Language forums, part of the PHP Programming Forums category; hi in c language, i do: char tmp_mnt_dir_www[75]; snprintf(tmp_mnt_dir_www, sizeof(tmp_mnt_dir_www),"%s/makehtml.lock", mnt_dir_www); how ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-17-2005
collinm
 
Posts: n/a
Default snprinf

hi

in c language, i do:

char tmp_mnt_dir_www[75];
snprintf(tmp_mnt_dir_www, sizeof(tmp_mnt_dir_www),"%s/makehtml.lock",
mnt_dir_www);

how to do the same thing in php?

thanks

Reply With Quote
  #2 (permalink)  
Old 05-17-2005
Oli Filth
 
Posts: n/a
Default Re: snprinf

collinm wrote:
> hi
>
> in c language, i do:
>
> char tmp_mnt_dir_www[75];
> snprintf(tmp_mnt_dir_www, sizeof(tmp_mnt_dir_www),"%s/makehtml.lock",
> mnt_dir_www);
>
> how to do the same thing in php?
>


$tmp_mnt_dir_www = sprintf("%s/makehtml.lock", $mnt_dir_www);
$tmp_mnt_dir_www = substr($tmp_mnt_dir_www, 0, 75);

(or possibly 74, I can't be bothered to work out whether you've
included space for null-terminator or not)

--
Oli

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:32 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0