Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Need help in understanding c code

Reply
Thread Tools

Need help in understanding c code

 
 
Herman.Schultz@gmail.com
Guest
Posts: n/a
 
      06-01-2007
Hi,

I see this code in vlc code. I have a question about this line:
net_Printf( VLC_OBJECT(p_access), p_sys->fd, pvs,
"Range: bytes="I64Fd"-\r\n", i_tell );

What is the meaning of "Range: bytes="I64Fd"-\r\n" ? especially I64Fd
(in double quotes)


static int Request( access_t *p_access, int64_t i_tell )
{
access_sys_t *p_sys = p_access->p_sys;
char *psz ;
v_socket_t *pvs = p_sys->p_vs;


//.....

net_Printf( VLC_OBJECT(p_access), p_sys->fd, pvs,
"Range: bytes="I64Fd"-\r\n", i_tell );

}

 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      06-01-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) said:

> Hi,
>
> I see this code in vlc code. I have a question about this line:
> net_Printf( VLC_OBJECT(p_access), p_sys->fd, pvs,
> "Range: bytes="I64Fd"-\r\n", i_tell );
>
> What is the meaning of "Range: bytes="I64Fd"-\r\n" ? especially I64Fd
> (in double quotes)


It's probably a #define for "whatever the heck net_Printf uses as a
format specifier for long long int". For example, it might be:

#define I64Fd "%I64d"

or it might be

#define I64Fd "%lld"

or something else.

The string literal concatenation rule makes it all join up properly for
the compiler.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 
Reply With Quote
 
 
 
 
Barry Schwarz
Guest
Posts: n/a
 
      06-02-2007
On Fri, 01 Jun 2007 14:14:47 -0000, (E-Mail Removed) wrote:

>Hi,
>
>I see this code in vlc code. I have a question about this line:
> net_Printf( VLC_OBJECT(p_access), p_sys->fd, pvs,
> "Range: bytes="I64Fd"-\r\n", i_tell );
>
>What is the meaning of "Range: bytes="I64Fd"-\r\n" ? especially I64Fd
>(in double quotes)
>
>

I64Fd is not in double quotes. The expression consists of three
parts:
1 - the string literal "Range: bytes="
2 - the "token" I64Fd
3 - the string literal "-\r\n"

As RH suggested, the token I64Fd is probably a #define that is set to
some string literal (for sake of discussion, assume the literal is
"%_"). Consequently, the entire expression consists of three string
literals. When string literals abut or are separated only by white
space, the compiler automatically concatenates them together. As a
result, when the line question is compiled, the expression will the
single string literal:
"Range: bytes=%_-\r\n"

As usual, the address of the literal will be the value passed to
net_Printf.


Remove del for email
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(newbie) need help understanding a few lines of code Ben Perl Misc 6 04-15-2009 11:23 PM
Need help in understanding a python code silverburgh.meryl@gmail.com Python 15 11-18-2008 12:20 AM
need help with understanding this little bit of code Daniel ASP .Net 8 09-13-2007 07:16 PM
Need help in understanding C++ code William.Joseph.Batson@gmail.com C++ 2 03-15-2007 04:55 AM
need help understanding this code. Elmbrook Javascript 7 09-28-2003 11:11 PM



Advertisments