performance-wise is it better to separate a function place function definition in func and prototype in funh or

Blocks, when, erm, they actually get around to releasing a stable build. Those rascals, constantly changing it. ( http://www.codeblocks.org/downloads.shtml )

what's size_t on 32 bit platforms?
long unsigned?

unsigned long int usually

ok

go have a look…

hm

no, that is not the accepted way to generate rands in a given range…

RobbieAB, thanks for your reply, would you have a better suggestion?

At least not according to the man page for rand…

Ooh. I guess I could read the man page for rand.

j = 1 + (int) (10.0 * (rand() / (RAND_MAX + 1.0)))
taken from the man page.

Yeah I found the page, thanks RobbieAB!

or, use random and not rand

koollman, is random spec or Linux only?

the man says 'CONFORMING TO 4.3BSD, POSIX.1-2001'

random is not part of the standard library according to my reference
though it is included in stdlib in glibc

so, not 'C99' or 'C89' or 'SVr4'

RobbieAB, what man page?

it's standard .. just depends of your choice of standards

its part of openssl actually

I think ISO C99 is accepted as the standard unless a different one is specified…

RobbieAB, ansi is the standard
until stated otherwise
first come, first serve

glibc man page.

RobbieAB, rand is part of glibc?

and no such code snippet

actually none at all

man rand on my linux hosting box brings #includestdlib.h

openssl does not use a lot of system functions …

and rand() is included in my copy of O'Reillys C in a Nutshell.

odd
wonder why it display's openssl's at my box

man 3 rand should show the libc version

yes it's a part of glibc

nope koollman

the comment about that code snippet is based on older implementations not always having reliable low order bits…

SYNOPSIS #include openssl/rand.h
rand() % max_rand_value should be fine

stdlib.h C89

:P nopealicious

The versions of rand() and srand() in the Linux C Library use the same random number generator as random(3) and srandom(3), so the
lower-order bits should be as random as the higher-order bits. However, on older rand() implementations, and on current implementa-
tions on different systems, the lower-order bits are much less random than the higher-order bits. Do not use this function in applica-

well … then you have a strange system where packages can put manpages in strange places

oops, sorry… Stupid irssi.

RobbieAB, seed, then use rand() (from stdlib.h)

koollman, gentoo

I know. we were discussing how to generate in a range, and I provided a code snippet from man rand

It's simple pseudo maths.
* pseudo
sorry I was afk

I'm so not relearning how to use a different random number generator, I just wanted to do a test case. :P

I know it is pretty simple, but should you use the high order bits or the low order bits?

hello friends, I couldnot somehow able to read the file, the contents are stored after XORing with original content. I want to encrypt the text and thus storing the encrypted string into a file. But i cannot able to read it back. I am using open("/tmp/test1", O_WRONLY, S_IRUSR |
S_IWUSR);

_good_day, dont forget lines ends are xored as well and data can become a line end

yes. and using read(fd,buff, sizeof buff); where char buff[1024]; , file has 11 characters only.

hi

anyother flag to open file in binary mode. or any comments please..

_good_day, open(file,"rb")?

okey.. good trying..

I wrote a little 100 character xor file reader that encrypted to rand+seed (passed in to it from the command line).

wow.. good. thats really good.

I don't have the code anymore though. :/
Very very simple thing to make.

hum.. matter of experience.

how can I set a const struct again :-[? Like "const struct {int x = 100; char c = 'c';} foo;" but as working C ?

_good_day, I made it when I barely knew C.

what are you talking about anyway ._. ?

_good_day, what's your problem exactly?

benny99, short xor file encryptor.

oh

zacs7, he is encrypting a text file with XOR, but then when it's encrypted it's no longer a text file.

so, does anybody know how to do that ?

benny99, that's not C89 at least. Nor that is how you initialise struct members.

… yeah, I know
but it's 2007-brain-language, how I call it, that shows people, what I want to do

_good_day, you're note actually reading EOF and encrypting it, then dumping it back are you?

but I need it in C90 now :P

benny99, and what DO you want to do?

setting the members of a const struct, like said in the text…

const struct foo = { 100, 'c' };

thanks

so, why didn't you look it up in your book?

sorry, somewhat out of C
I lent it to a friend long ago

yes.. i am reading the string only not the EOF, after encrypting, I am dumping it back.

then get it back.

maybe some day

_good_day, then what?

please go away.

lol
I love this channel

benny99, Don't push him.

I dislike lazy and stupid people.

XD
I love it !

if you cannot be bothered to have the basic material for learning, then it's a waste of everyones' time.

but while reading it back after storing the data after XORing i could not able to read the file.

I like this channel
sorry, I won't leave that fast

Zhivago, how could population doubling rate be compared over 5 years? I don't get it, usually it's looked at in 10 year blocks. Ie compare the population doubling rate in 2001 with 2006?

you will if you keep on asking silly questions without a book.
you have a growth rate.

interpolation of the growth curve?

yeah, I asked that many questions already, I really feel guilty

the doubling rate extrapolates from a growth rate to find how long it will take to double.

Zhivago, I've asked at Uni I assure you that, No one seems to know!?
Ahhh, thanks !

the growth rate changes over time, so the extrapolation likewise.
which university is this?

Monash

joining this channel and asking one, in numbers 1 question is some kind of bothering, hope that there aren't that many people doing that

hard to believe.
monash is supposed to be quite good for mathematics.

well it's true. It's not a math course FYI.

just shut up and get a C book.
well, then you should go to the math department, and they can set one of their grad students onto you with a pointy stick.

lol, okay. Thanks Zhivago & robberbaron
oops, RobbieAB

performance-wise, is it better to separate a function, place function definition in fun.c and prototype in fun.h? or i can just place my function definition in fun.h without need to write a prototype?

whatever, thanks, I'm gone now, as you desired

Zhivago, is there any reason why GCC writes to stderr and not stdout? Research turns up blank
Zhivago, sorry if I was targeting you, but you answered my question before about it.

some people say structs are 1/2 of an object. is there a way to put some void pointers there and giving struct a function member, so it's a little more of behavior? maybe (1/2 + .2) of an object?

yellow_chicken, there are function pointers if you mean that

yes

 Web Hosting | Hosting

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Leave a Comment

You must be logged in to post a comment.


Blog Tags:

Similar posts: