Re: procfs question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 27 Mar 2006, yenganti pradeep wrote:

>  Hi,
>        I tried that also. But the result is same.
> It is incrementing thrice each time. 
> 
>        Can anyone help me out?
> thanx,
> Pradeep

I can only see how that would happen if var was a pointer to a 3-byte
data structure.  Then an increment of var would be by 3.

Also maybe try naming your variable something other than var, which
might possibly conflict with something else on the system.

						-Bill



> --- Jeff Walter <jeffw@xxxxxxxxxxx> wrote:
> 
> > yenganti pradeep wrote:
> > > Value 0
> > > Value 3
> > > Value 6
> > > 
> > > etc...
> > > 
> > > Why is this three numbers increment? 
> > 
> > For some reason the increment you have is being
> > executed more than once.  Try 
> > moving the increment of value to its own line, so...
> > 
> > int length;
> > int var = 0;
> > 
> > length = sprintf (page, "Value %d",var);
> > var++;
> > 
> > return length;
> > 
> > 
> > --
> > Jeff Walter
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux