well, people here need to have their fun somehow
Meanwhile, I like to help folks that CARE to read and test, and visit folks I like.. Folks having issues with that can completely fuck-off.
adrahil, I dont use google, I much rather ask humans the questions
well, you should use google FIRST
Die.. Die young
PoppaVic, what your problem?
"What we are, unapologetically, is hostile to people who seem to be unwilling to think or to do their own homework before asking questions. People like that are time sinks . they take without giving back, and they waste time we could have spent on another question more interesting and another
person more worthy of an answer. We call people like this .losers. (and for historical reasons we sometimes spell it .lusers.)."
in the computer world, asking first from humans, without trying to look up answers on your own, is a big no-no
from http://www.catb.org/~esr/faqs/smart-questions.html - "How to ask questions the smart way"
thanks, guys.. I would have been more hostile and more rude.
it's okay you can still be, you can add some oil on the fire, as one says hee
you ppl suck. just cuz I said i'm new to C programming you act all big and wise
just READ this document: http://www.catb.org/~esr/faqs/smart-questions.html
i'm reading im reading
well, I don't LIKE having to be the "heavy", but geezus-keerist.
that FAQ is so old and pompous
so?
define "pompous"?
why even send people to it?
"having or exhibiting self-importance"
PoppaVic and all the rest of the ppl acting like "pros" - THE FACT THAT YOU HAVE MORE KNOWLEAGE DOESNT MAKE YOU ANY BETTER. so start acting civil, like your silly topic says. god I hate IRC ego trippers...
ok
yeah, well - we must be important, or they'd have solved it.. Or WANT human-feedback.. Note the precursor
yeah, well - we must be important, or they'd have solved it.. Or WANT human-feedback.. Note the precursor
it's either trivial or not.
and "not" means they tried to solve "trivial"
Please don't shout.
You need to link to the winsock library.
ok, installed mysql hosting and got the code to compile
stristr ? ew.
prec, thanks for the link. it would have been nice if someone would have just giving it to me when I asked the question. and if you dont like the way i'm searching for info, you really dont have to answer at all.
yes, bitbit it does.. Think it over, and stop acting like a rugrat watching anime, cartoons; collecting comics and playing stupid.
can you tell me why do you need to compile hosting it from source? is there something wrong with the .exe that comes in the zip
put-down-the-game-controller.. rtfm.. rtfb.... write the damned tests.
PoppaVic, wow. strong case, really. now that you gave me some many facts I can see you're right and i'm wrong -_-
rtfm? i asked for the fucking manual, you fucking idiot...
I already know you are wrong.. I don't even care if you learn it or why.
gtfm them
where is that damned mute button
MrG{DRGN}: /silence or /ignore
thanks
PoppaVic, so why dont you just shut up?
can you tell me why do you need to compile it from source? is there something wrong with the .exe that comes in the zip
i'm modifing it a bit
ok
don't burn down all your bridges
I hardly consider that jerk a bridge...
I know, but it's a daily thing - like taking a leak, shiting or reading a book
Nevertheless, politeness is recommended.
I started with dev-c++ way back.. I could never get a completely working setup under windows.. there were always problmes with include/header files (probably a lack of understanding on my part also)
so you're saying http://www.opencfd.co.uk/openfoam/doc/userse5.html wont help me?
under windows...
Of the 400+ folks in ##C, maybe 100 are real; of that 100 maybe 1/3 are AWAKE at any any time - call it 33.. Of that 33, there are maybe 30 that learned with blood, sweat and tears.. Do you actually expect them to save some moron too lame to buy a few "clew"?
is that guy still talking about me? I need a translator, honest.
oh well
http://www.rohitab.com/discuss/index.php?showtopic=20122&pid=171011&mode=threaded&start=
Somewhere, somehow, you are expected to have a C compile (usually gcc), at least K&R as a book, and both access to google, manpages and TEST-time.
yeah - folks need a beating.. DAmned rugrats
what was the worst question of all? the one you'll always remember?
Geezus... the idea of my ol' man hearing I expected him to teach me... brrrrr
oh, hell - better to ask Baughn... I've seen sooooo many over the years that made me ask "umm, did you look for help? man? a BOOK?"
PoppaVic is only capable of speaking in generalities. :|
and those serve more often than not - I respect folks that focus the "contexts" ;-)
"what is main()?", "what is an 'int'" - lord, we'be seen it all
I fondly recall "Why can't the computer figure out the printf should be after the gets"
wow
oh, geezus
Oo
yeah
"you're smarter than the computer"
-_-
no.. THAT would be "casting"..
char *line; printf(line); line = gets(line); -- if I recall
the computer is just hw that runs and interprets
oh, geezus
wow
oh, he quit :P
still - it makes you want to cry or scream or fold the chair and BEAT someone
No, I took that reasonably well. What made me cry was when a lurker told him to run valgrind on it.
wtf choice did it have? No one here was about to write complete solutions for a lamer
uwtf choice did it have? No one here was about to write complete solutions for a lamer/u
buwtf choice did it have? No one here was about to write complete solutions for a lamer/u/b
Some days.. ;-)
you aren't that smart etc.
but I guess it was too indirect
some days I FEEL like the "evil-ogre-older-brother" and other days, well... Shit.. I wonder wtf planet/universe folks come from
perhaps... I find the limited AI of computers useful.. I find the wtf is an AI?? of newbies to be depressing
certainly neither I nor ##C has any mandate to save some clown from failing a test/course/class/job
damn, I was hoping you'd help me ;/
I already know Baughn and Zhivago and Xgc and twkm (and others) can become confused or rude when folks don't _communicate_.. I doubt any of them are willing to suffer complete fools.
And, How can anyone blame them?
yeah, right ;-)
hehe.. and I have no probs when 2-dozen folks - learning C with blood and sweat - leap on some clone ;-)
Sometimes "mob-rule" is fun. ;-)
good eating
I missed my cooking show... bastards
sure
good day
beyond taking off -fomit-fp and adding -ggdb and nostrip to CFLAGS, what else should be done for a debug build? hmm -O turned off. anything else
anyone here good with inline mips asm?
isn't there an #asm ?
yes
But they only do pure ASM =3
oh inline sry
wtf is =3 - a kiss-off?
depends whos in #asm
Debugging? No, -ggdb should be plenty. -fomit-frame-pointer won't actually degrade it as much as you think (for recent versions of gdb), but by all means turn it off. Oh, and avoid -s
Only thing I can think of is that it's helpful to have debugging libraries installed as well
ok thanks BrigadierFrog
isn't s for asm?
oh that's S sorry
yeah this is for when i want to switch compile options, thanks Baughn
Of course you should /always/ have warnings turned on
Bush is like the X86 - no one wants him but he's still president
In more ways than one. Without Microsoft and Commerical application backing X86 would not be as heavly used.
True.
good nigth
hey how do i detect what compiler my code's being compiled with? I want to do something like #if compiler == GCC and version = 4.2
__GNUC__ will probably beo of help... read the gcc cdocs....
hm
say, I have a problem
could someone help me understand why this code crashes:
http://rafb.net/p/QIr4RB53.html
none of the str functions allow overlapping objects.
but the crash is on free() not any of the string functions
undefined behavior doesn't have to become apparent where you feel it should.
your strncpy(mesg+i, mesg+i+1, 1023); write too much
you write out of the memory you allocated, so dont be surprised if there is a segfault
yes you appear to be correct, changing strncpy to just strcpy prevents the crash
strncpy padds with zeros the destination
ohhhh
i thought strncpy just copied UP TO n bytes, but that it quit as soon as it found a '\0'. Didn't know it padded the remainder
it doesn't say anything about padding on the man page
it does on mine
actually it does on mine too I just never noticed it
heh heh
alright thanks
i'll make it smarter about knowing how many bytes in can copy
try not to strcpy two strings that overlaps
use a buffer
the man explicitly says "The strings may not overlap"
and include string.h
yes very good (and I already caught the string.h thing)
i will use memmove() then
Does anyone know a way to execute an application in linux host and find out its process id? I don't mean system(), or if system is the only way to run programs, how do I then find out its id
_mEo_, getpid()
does this look good to you:
http://rafb.net/p/6ntSSJ84.html
does that get the id of the main application though
man execv
Ok
fez, how do I then get the pid or is that the return value
within the program; within another program; or just from the command prompt
the one executed through execv
or system or whatever
fork() returns the process id, then run execve to start the new process
actually execv transfers control to the other program
yeah like nooper_ said
So I go fork() and then execv, the return of fork is the pid of execv
fork exec tutorial, http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=421
thanks for that
I'll hve a look now
0) { /* child process PID = pid */ } else { execve("your program"); }
in the parent process, fork() returns the PID of the child process
in the child process, the return value of the fork() call will appear to be 0
that is how you can tell which process you're in
so check the return value of fork()
k
if it's 0, then use whichever exec-family call you need to do whatever it is you want to do
the execwhatever functions don't start a new process
rather
shouldn't the exec be in the child process?
they replace the current process image host with whatever program you pass to exec
i guess it doesn't matter
so it will have the same PID as the process created by the fork() call in the parent
it should be, and in the code he gave it is
note the "else" there
what's the second argument for execv sorry?
_mEo_, RTFM
0 part no?
sorry drdo..
read it very carefully
err nevermind, sorry
if the return value of fork() is 0, then it goes to the "else" and calls execve()
it is... (in child, pid == 0)
What did the monk say to the hot dog vendor?
Make me one.. with everything
i don't get it
Spark is one intergredient short of a full hot dog
is ther esome website with hints, tips, little tutorials about C programming?
http://www.iso-9899.info/wiki/Main_Page#Additional_materials
is it something to do with "sauce"
:se noai
a:se ai
sorry folks
what does #pragma do?
hello
they specifiy compiler options
hi
i want to ask what things can be concatenated with ##
macro's
can + and = be concatenated?
sure
e.g A is + and B is =, so A##B is += , is that true?
what's the exclude switch to exclude a file from compilation/linking
well you'd just #define CONCAT(A, B) A##B, and then call CONCAT(+, to make +=
that's compile host specific, see your documentation
commenting the source file out of the makefile would be one way to stop it from being compiled
_CheckedChanged is called when i do .Checked = true; in the code, but is there a way only check when it's the user that actually clicked and not me in the code?
WTF is _CheckChanged?
the event
!smart Klipsch
smart is See http://www.catb.org/~esr/faqs/smart-questions.html
mycheckbox_CheckedChanged
hi, i'm new to c and i was wandering if any of you guys could give me an example of a super-basic kernel?
[1]MasterBlaster: OS kernel?
yes, please
I love seeing some of the questions people ask around here.
like text-mode, REALLY basic
[1]: minix was originally meant to be a educational project. i think recent versions try to be more, but you could always look at the older stuff. it is how Linus started out . :-)
true, but i meant as in just booting up and printing some text. something i could build up or learn from.
vorpal whats the prob about my question?
[1]MasterBlaster: in our OS class we had to code drivers to a crappy VM package tortured into existence by several apatheic faculty members
whats the biggest non floating point numerical datatype ?
vorpal, :p
there was absolutely no context. it's as if you thought we were sitting beside you at your keyboard.
It really sounds like you're asking in the wrong channel.
Does posix define a maximum length for passwd username/group lengths?
you can use an arbitrary precision floating point library
i just have trouble to ask in english
i mean something really simple. no drivers. no programs. just write directly to video memory
light, i said non floating point
then exit
Or is it implementation specific?
there is an even on the ON CHECKED CHANGE of my checkbox
I misread, well you can use an arbitrary precision integer library if you like
then exit the OS, i mean
when the even happen it execute the content of what ever function i seted
still get me?
light, could you still answer my actual question ?
well the answer is the largest datatype you can get is for all intents and purposes infinite
unless you mean within the C spec
what is a non-floating-point datatype?
vorpal, like a integer or a char
light, within the c spec
see /usr/include/sys/limits.h
i'm gonna go look into minix, thanks guys, signing off
you may be looking for "long long" or uint64_t ( within the language spec )
you can have arbitrarily large numbers with a bignum lib, as light mentioned
uint64_t is not guaranteed to exist, mind. Just how large an integer are you actually looking for?
long long
:-)
long long is variable length. But if that's what you want, go ahead and use it.
variable length ?
The C standard (C99) does not specify how large it can be
Only a minimum size
c doesn't have a power of operator, does it ?
No, but it does have pow()
no, but if it is a power of two, use bit shift operator
assuming integer operands, of course
otherwise, pow(), as BAughn said
how do i printf a long long ?
%ll, oddly enough
(Check your manpage next time)
somehow that prints %
ll is merely the proper length modifier.
what's the best hosting language to learn OO?
apl.
asm
C
or FORTRAN
by using languages that don't have constructs designed to facilitate OOP
it really reinforces in you the fact that OOP is a program web design paradigm
rather than a language feature
what about java
isnt it 100% OO
what can i do with C regular?
what programs are coded in C regular?
and C++?
fortran sounds too old
gcc's version seems to create bloated applications.
http://www.wikihow.com/Make-a-Poop-Tube
cut a piece a paper into 10 strips. on each strip, write the name of a language you are interested in. put the strips in a hat. shake the hat. pick a strip out of the hat. learn the language to a reasonable level of competence. pick the next strip out of the hat. repeat.
No, no. After learning the first language, you write a program in it to randomly select the next language to learn.
great idea :-)
After learning the last language, you write a program which can learn new languages _for_ you.
until you are dead.
I think it's one of guile future features
synergys doesn't accept a configuration file name of "-".
Is there a source-version of things like vsnprintf etc?
source-version?
ja, I'm getting a strange memory allocation issue on a Knoppix-server box which doesn't MANIFEST java host on any other machine
all valgrind can give me is that vsnprintf() is where things are going AWOL
you mean "originally written in c"?
or do you just want some debugging symbols and code to pinpoint the error
the function is part of libc
what does _(( mean in void blah _((int*, float*)); ?
Where is it defined?
I'm willing to bet that it is a macro which expands to () in the case of pre-ANSI C compilers..
ruby.h
And how is it defined?
in vim, I can't find anythihg with /#define _(
I mean, where is _ defined?
It's there.
how can I search for it
/_
It's possible that it might be defined in the build system.
and / _
/\_\
are both too many false
okay
-_-
/#define.*\_\
does not find it
what's the proper way to say..... fread( &(mystruct-myint), ...
right now it's complaning that "expression must have pointer type"
Check included files.
Don't read directly into an int object.
&structptr-member is a pointer.
look into defines.h
whats the best method for getting a single character of input from stdin?
getchar?
lets try that
btw, you won the bet
thanks
which?
about the expands to () for pre-ANSI-C
And expands to its argument otherwise
I didn't know there was a bet. What do I win?
a wet handshake?
Well, it is brewed at least.
Why can't you overload functions in C?
it's not part of the C spec
Is there a way to simulate function overloading?
if you have to ask you are a long way from being able to do it.
Twkm, how so?
how to do it is fairly clear when you are well versed in c.
Twkm, I guess you think that I am not "well versed in C".
correct.
Twkm, are you "well versed in C"?
all you need is a framework whereby you never use intrinsic types directly, only via macros that invoke functions based on indirection and "type" fields.
if you have an enum, and you specify specific integer values to correspond to some of the enum members and leave others to default, does C guarantee that the values assigned for the others won't collide with the explicitly set ones?
no.
that makes it kinda pointless to support methinks. Oh well.
*shrug*
What is pointless to support?
assigning explicit values to some keys in an enum but not others
I don't understand why that is pointless.
if it can introduce value collisions then its a useless feature. Dangerous even.
enum { A = 4, B, C }; /* B == 5, C == 6 */
Nonsense. It can be useful, in fact.
so there is an anti collision mechanism?
enum { one = 1, two, three, ten = 10, eleven, twelve };
No.
enum { A, B = 0 }; /* A == B */
it increments the last assigned value for the following ones
Yes, just like it says in your C book, right? :P
I really should get that from home
not too along ago you suggested that I take a look at coreutils to find the maximum allowed length of a username
at least I think that was you
docs came up with nothing
Doesn't sound like something I'd say.
er, yeah
sorry
/* it's not here? */
looking
sysconf(_SC_LOGIN_NAME_MAX)
9.
Didn't know posix defined it
yeah, they do such things there ..
I'd figure the same goes for groups?
what function do I use to check the status of a process?
from its PID?
there is nothing standard for such a thing.
in posix?
on posix-ish systems if the process is a child there are some functions available.
well, I'm forking them with fork()
and I want to test if they are still running, periodically
wait
wait, waitpid, handle the signal that occurs when they die, ...
well, I don't really want to block
man wait
Yes, it's (probably) a long page. But you should read it in its entirety.
ah ok
I missed the part
about the WNOHANG flag
'lo
I've been trying to learn pointers but it's still confusing, anyone know of a good way to learn pointers in C?
a good book.
any recommendations
?
http://www.iso-9899.info/wiki/Books
K&R C?
the second edition, which covers c89.
"The ANSI C..."
?
now it sounds like you want us to help you select something to steal. because the books section of the wiki really isn't that hard to use.
http://cm.bell-labs.com/cm/cs/cbook/
I think I already have it with my other ebooks
has someone used curses.h?
in england they say things like "arse"
who has seen that 3-parter Dr Who for this season... holy cow!
I'm getting a sigsegv using "noecho()"
did you remember to initscr first?
twkm, hmmm... no :-(
/ on init, signal(SEGV,SIG_IGN);
twkm, thansk (maybe I should read the documentation carefully)
GreaseMonkey,
(int * double) / int results in..
what does your book suggest?
suggest?
I don't have my book.. I just can't remember :p haven't used C in awhile
find the free C99 download then ;-)
actually I do have the book I learned with but it's absolutely terrible.. most of what I learned I learned on the net and IRC x)
which book?
Absolute Beginner's Guide to C.. the one with the explorer guy on the front
hmm. never heard of it. oh well. so, did it explain promotions used in expressions?
no
is the answer double? cause then I know what you're talking about
that's annoying, it is critical information.
yeah, I know
it might have explained them.. it was a long time ago that I read it.. but I remember there being a lot of stuff left out
anyway, int * double requires that one of the change type. floating point wins.
okay, then it works like I thought. thanks
You can't name int pointer variables 'double' !
you shouldn't be able to ignore segfaults
is there some sort of standard for commenting code in C (i.e, function, arguments, return types, etc) ?
Schroeder, you can still trap them at least
from man signal:
According to POSIX, the behaviour of a process is undefined after it
ignores a SIGFPE, SIGILL, or SIGSEGV signal that was not generated by
the kill(2) or the raise(3) functions.
besides, it was a joke\
you can, but, as the man page says, the behavior is undefined
it's a bad idea
yeah, of course
what are invalid characters in UNIX filenames?, and how can I strip them from a string?
'/' and '\0' and the name can't be empty, nor ".", nor ".."
anyone familiar with buffer overflows?
hmm
I think everyone has heard of them
making those happen comes easy to me
i mean, does anybody know them in and out, and knows how to write proper exploits?
Question, how would I go along of creating a string containing a timestamp from a struct tm?
Is there something obvious that I'm just missing?
sprintf
I mean unix timestamp.
So the number of seconds since unix epoch.
Sorry, wasn't specific.
God.
I'm retarded.
so does anyone know how to write a proper buffer overflow exploit?
yes
?
he's gonna sell his styles sanmarcos
business has taken over
eh?
tenX, do you have the postcards from Paraguay?
i wish i had some
you go to Ciudad del Este and you can buy all sorts of shit, cocaine, russian shoulder launched SAMs, copies of watches and perfume
but no ICBMs?
nope. those arent usually for sale
but you know the russians, for money they will sell you anything
another tip you might consider, if you go out with prostitutes in Asucion, make sure they are the nice kind, the ones with the escort services in the newspaper, not the ones from the street. Those might lead you to an "aguantadero" were four or five guys beat you down, take everything from you
and leave you naked on the street. Believe me, been there, done that. All in all, quality has dropped over the past few years.
you definately dont want to be lead into an "aguantadero"
s/lead/led
oh, I don't know -- some people pay good money for that kind of thing.
so again, what does char **string; do in a function def?
it dereferences a pointer? as to have the value?
sanmarcos
you were beaten and mugged then left naked?
are the russian chicks hot
maybe they have diseases though
lol
Erm, C... programming...
indeed, that was long ago
I am more interesd in char **string
in the header for a function? if so, it's just telling you what type it expects, which would be a pointer to a pointer to char
thanks
does anyone happen to have a copy of the c89 standard?
check the ansi home page
Legally you need to pay for it or something.
why cant I do return (int)strlen(*string);
not if you get the draft
incompatible implicit declaration of built-in function ‘strlen’
are you trying to define strlen() or call it?
#include string.h
Erm.
:p
is this ugly? http://rafb.net/p/k9r1rw67.html are there better ways to do it? I just need to pass a char * reference to a function to get the values
first of all, there's no need for the &*, second of all, this code doesn't appear to do anything
Frasha, its pseudo-code, I didnt want to paste 1000 lines
nice, no need for the &*
right, because it already has the reference to the char pointer
if you're thinking that you need the parameter to be char ** for you to be able to modify it, forget it, one * will work
the only reason to use char ** is if you need to modify the pointer itself, but i don't think that's what you should be doing
in which function?
the thing is, the one that uses char ** in the first place, is not my code, and I dont want to mess with it (see function header comments)
so, I am adapting my code to be able to work with it (I am a newbie)
whose code is it and why are you using it?
an http library, http_fetcher (sourceforge), file http_fetcher.c, method http_fetch(), if you really want to know
http://http-fetcher.sourceforge.net/API/html/http_fetch.html that exactly (FYI)
but hey, my sample compiles with no warnings in -Wall, so I am happy, plus I learned some stuff
oh fark me... when oh when will I learn NOT to put in constants for fgets
i think you should perhaps start with something simpler
hello
someone use emacs?
http://rafb.net/p/0CkPwD82.html
This is my .emacs. I whant to set BOLD character.
:°°°°°°°°°°(
there's an emacs channel, they could probably help
Freenode has no place for crybabies.
exist but do not exist
i was in this channel
but nobody helped me
i don't think anyone here uses emacs, though, so i doubt you'll find help here either
I installed emacs I forget why
I think it was because a c book from 1982 said to do so
#c on efnet is trans
i need to get my mind refocused on the aquisition of knowledge and edumakation...i am losing focus and disciplin!
So ?
just thinking out aloud
pear, drink powerthirst
good idea!
LOL
hi again, sanmarcos, did you fix your rss reader
http://rafb.net/p/0JpNCH49.html why would this cause a segfault?
char * checkFilename(char *filename) {
char * newfile = checkFilename(file);
Figure it out
You should learn how to use pointers.
man strspn
Sup cehteh
if (strcspn(filename, "/\\?%*:|\""") != strlen(filename)) error
Are you still learning C without reading a book
while i dont see that all these characters are illegal for filenames
hehe scared him
He hates reading man pages.
Hi.
I actually do like reading manpages
Cool
once I learned all the cool little numbers to put beforehand the name, I was like "wow"
What ?
Am I the only one that hasn't slept
yes strcspn seems to be a much more straight forward way to do it
huja, I know a lot of those arent invalid, but I am writing a cross platform FUSE driver, so, I might as well remove those, its no big deal
And you still haven't read a c book yet? Wow..
yes, I have a copy of K&R here
I learn better trying
Yeah
You're proficent in other langs though I assume
unfortunately for you, there is a lot of C code that will compile but have undefined results
How far have you gotten with k&r
You should also study this too .. (hold)
www.eskimo.com/~scs/cclass/krnotes/top.html
I havent read it all, but I understand most examples I only look at it when I need it (i.e pointers)
Do you understand this: rafb.net/p/DcRuUf38.html
let me give it a guess
char b[] forms some sort of string in memory/ascii. char * a (string), then (char *) types cast the memory address of &b (the built string)
then *a++ increases the pointer (by character)
the rest is just a lot of pointer, reference, and so on
which in the end, prints hello world
;D
You know C# right ?
Hmm, was it you
Or was it someone else.
can anyone explain this? http://rafb.net/p/Ldxg8s74.html
apart from the fact i probably shouldnt use system()
What's there to explain
Did you code this ?
yes, and it won't run on apache because the system() output was above the first printf output
nope, it still moves itself to the top =\
for one thing it should be \r\n\r\n not just \n\n
Ugh
People code funny things
how the hell did i screw up a 3 line program
hi everyone
Hi NetLarIrvine
sorry, just testing out some commands
Great
this is slightly annoying
now i might have to do some actual work to see the environment
TehSausage, not really, look into getenv() perhaps
sizeof(myarray) returns 40, because, I have 10 elements, and each char is 4 bytes i assume, so char * invalidchar[10] = {"/", "\\", "?", "%", "*", ":", "|", "\"", "", ""}; how can I calculate the real sizeof of that array? (10)
yeah, but i don't know what any are called D:
"and each char is 4 bytes i assume"
shouldn't you do char invalidchar[10]={'/', '\\', '?', '%', '*', ':', '|', '"', '', '' }?
besides, it's still an array of pointers
right, I dont want that
Why is this important anyway
but I didnt know there was a difference between " and '
well, there is
'A' is a single char
"A" is a string
" = Character string constants
which is a pointer to a (char *)
'AB' is illegal "AB" is not.
i mean it's a pointer to a char
5 bytes, 4 more than it should be
moin
\\ is a string though
moin
I thought I needed that so C doesnt try to escape the '
sanmarcos, you have to iterate over each word and to calculate her size.
Or "\\" rather.
(Hm, But it's a single \ character. '\' is ok)
Tfu! '\\' is ok
"\\" is the same as "AB" is it not
you have '\'' and '\\'
In char string sense.
so it's '\\' to not confuse it
\ is special char; like in: \n \r When you write \\ you mean "normal \"
right
That's an escape sequence.
then there's stuff like '\x01' and '\n'
If you're printing the backslash then yes.
But you aren't
You're printing \\ denoted as \\
To print \\ you would write: "\\\\".
So in single quotes you'd use '\\' ?
And it would print as is ?
As \.
GreaseMonkey gave good example why it's so.
still, even if I wanted to, I couldnt use the elements of that array, like ':', in strstr()
Exactly. So ..
What are we arguing about
TehSausage, also on *nix main() can take a 3rd parameter char **environ that is a list of environment variables
sanmarcos, but it's simple to write a loop which will do the strstr job for single character.
huja, I don't know.
Meh
thanks :P
vorago, right, but it cant be typecasted into (char *)myarray[i]
i just piped the system() call aswell, and got a file with it, i probably shouldve just read the cgi spec though XD
I would have to write my own strstr implementation
sanmarcos, No. Strings have this queer property that they are ended with '\0' and functions from string.h WANTS to find that character at the end. Therefore "a" is 2 bytes big. 'a' is one byte big. And they are completely different.
Not necessary strstr() implementation; you are looking for a char in a string just.
In POSIX and BSD there's a char *index(const char *s, int c);
Which I guess does what you want.
Are you learning C just for this purpose ?
Och, and strchr(). In C99
i already know C
vorago, nice
wrong answer
i just never thought of the way system() works before trying that
what way did you think system() worked before now
Okay, I'll be back later.
can somebody explain why if ((index(filename, invalidchar[i])) != NULL) causes a segfault, but not if (index(filename, invalidchar[i]) != NULL)
the double parenthesis mean?
eh, nevermind, err
is there a function to convert the 'a', 'b' 'c', int char's to char *?, or just do mychar += '\0'; and typecast them?
sanmarcos, man sprintf
i'm doing something then heading to bed. cya.
just don't get it on your keyboard
'night
I need to buy cigarettes.
Brb.
Is this channel non-smoking?
I don't think it matters
you can order pizza from the command line but cant buy smokes (yet)
You can order pizza from the command line ?
there is a perl script called pizza-party/ Our admin has it set up as a cron job
http://www.beigerecords.com/cory/pizza_party/
haha wow, it's times like these where I'm proud to be a nerd
I am working on an asterisk controlled soda machine
International pizza delivery?
FatalError, sprintf(mynewstring, "%c", myarray[i]) ,do I need to include \0 ?
sanmarcos, no, sprintf() does for you
it is interesting, I am logged in twice to this channel, and I see different logs in each one
even when I am on the same node
One is lagging sanmarcos.
is there a function that returns true if in a array of string constants is located the string constant that the user enters ?
You can use index() with a loop of some sort
strspn ?
Or rindex()
Nah, rindex() won't do it
how would I loop for each character in a char *?
const char *a = "some string"; while (a++) { /* doe somthing with a */ }
that increases where the pointer begins
I need to have a variable in a loop for each characte
const char *s = "some string"; s[0], s[1], s[2], etc
up to s[strlen(s) - 1]
anna_macgyver ?
no the guy in the movie man
lol
he likes to keep it quiet tho
so don't tell anyone he's here
/jk
is there a function to find something within an array? say if character 'a' is an item in an array?
yeah, look at the string.h manpage
you could just look for it you know?
http://www.acm.uiuc.edu/webmonkeys/book/c_guide/2.14.html
wtf header files have manpages?!
this would be the string manpage (without the .h)
no shit
oh
what ?
HEADER FILES HAVE MAN PAGES ADRAHIL ?
yes
I DIDN'T KNOW THAT
do "man string"
:P
or man stdio, or man anything
yeah, look at the string.h manpage
.h
Is what I meant.
so ?
it works too
check it out
man string.h
corridor:~ ralph$ man stdio.h
No manual entry for stdio.h
SILENCE
lol
corridor:~ ralph$ man string.h
No manual entry for string.h
SILENCE
adrahil@titan ~ $ man string.h | wc -l
98
so you don't have them installed
apparently
actually, works for me too
ey all, what does syncronous mean? Ive looked up definitions but um they doesnt seem good (
lehnix users
corridor:~ ralph$ uname -a
0 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386 i386
oh, you're using a bastard system
is that osx?
yah
and you're using..
adrahil@titan ~ $ uname -a
0 CEST 2007 i686 AMD Athlon(tm) XP 2500+ AuthenticAMD
grsec, that's pretty cool
they did some nice patches
i should write a mac model someday
like selinux
i think it would be hard to
yes..
although that now they all are on Intel cores, it might have gotten easier
heh string and string.h are both on Gentoo (and slightly diff
:P
well, choose wisely then
fuck that i'm printing em all off when i cba
oops
but i think you're searching for strchr
sorry for lang
OK, C question time.
-_^
http://rafb.net/p/DvbRax77.html, but it segfaults on the first outb() in the first loop
which line is that then
not the #
lcd.c:28: warning: large integer implicitly truncated to unsigned type
hmm
how can I do something like char * filename = "string"; filename[4] = 'b'; (that wont work right, because it tries to write to a pointer?)
and i think it might be related, seeing as the warning occurs on the line the segfault occurs at
which line is that then
28
not the #
oh, right
outb(DATA, 0x0F);
and how is DATA declared?
string constants are probably read only
wait
i just noticed what i did wrong
v.v
keyn, its not const..
the order in outb is value, address
and i'm doing address, value
yah
lol
ah ok
it's opposite from DOS
yes, but the compiler is allowed to put string constants in the code section, meaning you can't write to it
Ugh, don't you hate it when bugs dissapear when you turn /on/ debugging!?
so. it does... something now
good
const refers to the variable i think, rather than its content
doesn't segfault and the LCD on my parallel port blinks.
Ship your code with a debugger?
keyn, ok, so I cant change a specific char in a char * array when defined as char * var = "blah";
lol
thanks, for bothering, anyway :p
how long have you been coding
const can be either ptr or its content
(or both)
well, for a few years since I'm 10, so it's been around 10 years of coding
hehe
it might work if you do char s[] = "abc"; because then then it is on the stack, not cure though
is english your native lang
sure*
what was your first code lang?
nope, russian is
BASIC
you smile quite frequently
from the QBASIC implementation by Microsoft
and the 2nd?
sorry, it's the 8 years of IRC...
Perl
woah
lahf
man i find perl gives me a headache. but i like awk
i now use Python for scripting, it's really good
yeah
have you seen http://pida.co.uk/ ?
my apps come with some pretty comprehensive internal debugging outputs
huja, which function do you think is better http://rafb.net/p/PGoFXF46.html ?
a mate of mine put it in portage t'other day (0.5.0)
you could almost rebuild the entire program with the output on 'fine'
cute I mostly use IDLE, which is shipped with pretty much all of the Python distros
hehe so you /don't/ use gentoo. cool
notadev, pida is awesome
++
there is one which is good too, ERIC
http://www.die-offenbachs.de/eric/index.html
loading..
notadev, I use it solely for my Python project (http://itaka.jardinpresente.com.ar
i haven't used it much yet
Gentoo is like fapping to Britney Spears
strcspn
but the GNUDB plugin looks nice sanmarcos as does the python plugin and the py debugger
http://www.die-offenbachs.de/eric/images/eric4-screen-01.png
GNUGDB sorry
notadev, yes, its pretty slick, it integrates with everything
hmm GNUDB would be nice tho
why don't people just call it gdb
huja, so the first one
i just don't know much py tbh. it looks too simple
notadev, its a pleasure to work with
Lego looks simple.
the second one is preferrable
you're getting a hang of this quite quickly
yeah
have you seen Lego City?
Of course, if you're bored you can make neat things with Python as well...
i used to run gentoo
huja, yes, I wanted to do two different approaches, just to learn some more, either way, both work, and I do like the second one beter too
now i run osx/arch
that's what i need tho
on a Mac?
no, on a hp nx6110
i have osx on a macbook
to atract the females?
oh okay
Nah, it just works for me.
although i could buy three nx6110's with one blackbook
i'm getting myself a new laptop soon
ThinkPad T61
i guess i'll build a gentoo on it
heh it rocks on IBM; all Linuxen do
but good choice adrahil :
um sorry for :
i don't like thinkpads
why not?
but maybe i'll get an ibm laptop sooner or later
but that'll be after i get my pro
i find them hard to work on
and they overheat
ibm machines are very dependable though
i think they made some improvements
heh that;s the CPU silly
A few decades of mainframes might have helped that...
lol
heh
Speaking of which, this laptop is going for repairs for a week or something.
use a BINHOST (that's the var iirc PORTAGE_)
You'd think fitting a key back into its socket is straightforward, but noooo!
under warranty?
i guess
heh if you were in the US, i'd tell you the man's name
I don't trust these people. I'll have to back up my 3-year-old lousy code, misconfigured libraries, IRC logs and all that porn.
lol
well it's Griz if you see him about
(and are US)
he's very busy tho i'll mention you to him
?
eh?
Griz?
http://www.aseanenvironment.info/Abstract/41014202.pdf
nah wrong IP
wow
"Incense was discovered to be a significant source of polycyclic aromatic hydrocarbons (PAHs), carbon monoxide (CO), benzene, isoprene and particulate matters"
Err... whoops.
"stick that in your pipe and pipe down, and don't think for a minute that I won't go into the Oval Office, right now and.."
lol
hehe
Organic carbon, elementary carbon, 6 inorganic ions and 40 elements in PM2.5 from 10 incense combustion were investigated.
yeah
check graphs on page 9
and what do petrol fumes contain?
in what percentages?
!chill
OK, it's getting a little hairy, and really we're all here because we love C. So relax, take a walk, have a cuppa, whatever. Er.. please?
?
hairy..
hehe
!candide
candide is a bot. See http://www.iso-9899.info/wiki/Candide for more information.
HI I'M A BALLERINA
hehe
how long have you been coding
oh a fair while i'm afraid.. ASM since 1980
;o
o;
i thought you were young
like me
];
what arch do you work on
(MIPS FTW!)
i want to learn mips/sparc
ppc
heh x86 and ARM
and i want to get better at x86
but i don't code on x86
i know someone that knows arm
yeah me too
some guy called batched
hehe
i need to learn ARM :P
so install crossdev on gentoo
he has a paper on milw0rm somewhere
crossdev?
i try to do a little bit of Xscale ARM for my Palm
but i fail
the language is really complex
oh well it's inline
http://milw0rm.com/papers/128
XScale sucks
why?
cos it;s Intel
ever wondered why you never saw a 3.4GHz ARM?
is it true that gentoo-2007.0 doesn't have dhcpcd support on the livecd?
no
why not?
i need to work on my x86 asm.. i'm pretty poor
you have to install it on your own sys tho
oh sorry, cos Intel bought all the ARM farb off DEC about 10 years ago
they only sold it last year
yay!
it's life
im going out to smoke now
brb
smoking kills
heh so do cars
true
so does life
and i didn't see no-one asking my permission to pollute my kid's lungs
must have been me
well, isn't it getting forbidden to smoke in public areas?
teh sigh
and what do petrol fumes contain?
in what percentages?
it's starting to work
(the LCD-on-parallel-port thing)
nice
i'm just writing my own interface code now
according to the controller chip datasheet
this is a great resource http://c-faq.com/index.html it should be used more here, perhaps a bo
bot
or even a /topic page
!faq
faq [match #] search regex
ooh nice
!faq floating
14. Floating Point, 14.4 My floating-point calculations are acting strangely and giving me different answers on different machines. : http://www.eskimo.com/~scs/C-faq/q14.4.html
wow
more
hmm nm
!faq 6.2
6. Arrays and Pointers, 6.2 But I heard that char a[] was identical to char *a. : http://www.eskimo.com/~scs/C-faq/q6.2.html
nice
The document name you requested (/q14.4.html) could not be found on this server. However, we found documents with names similar to the one you requested.
lol
there is a new url c-faq.com
what are you doing?
yeah like 14.5 is the same one
http://www.beyondlogic.org/parlcd/parlcd.htm to work
did the soldering and all. just trying to interface the LCD
getting there though. i can already clear it
oh, cool
im going to bed
night all (at 11am)
hi
is strtol thread-safe?
i mean because of errno
man errno says it is thread local
which means?
that errno is thread local
which manual are you reading? cant see this in the posix man
on a linux machine
se
http://rafb.net/p/6TM7Vl33.html -- this program compiles and run with out compile errors. question, why did the compiler not warn me about assigning -9 to an unsigned integer?
since unsigned integer starts from 0 to SOME_BIG_VALUE
what compiler?
gcc
try -Wall
alias gcc='gcc -Wall -pedantic -ansi $1' --- i have that on .bashrc
because it'll just wrap around
is there another gcc -option for me to turn on, so that compiler will warn me?
gccwarnings
hm, guess that only works with Oort
this is pissing me off. stupid LCD
question #2, if change line #10, to {printf("Unsigned Integer = %d \n", (int *) number);} the compiler will tell me incompatible type
because %d expects an int and you're giving it a pointer to an int
yes
or actually the warning could be because you're casting an integer to a pointer to an integer
now look back at line#10, %d expects integer, but i place an unsigned integer there.
printf("Unsigned Integer = %d \n", number);
the variable number is an unsigned int.
I'm off, don't write broken code seems to be the thing to do ^_^
i think %u is unsigned integer
ok. just want to find out if gcc has an option to turn on some more warnings
yes, %u is U. I.
-Wall?
i ve already turn on Wall
-Wall -Wextra
ok , let me try that one
no good, did not give me warning
maybe it didn't warn because it's actually safe
signed and unsigned are just different ways of interpreting an int
try compile this code http://rafb.net/p/6TM7Vl33.html and try find a way to make gcc to give warnings about unsigned int number = -9;
hm... maybe
why should it give a warning?
I don't think it should.
hi
unsigned int foo = -1; is a common way to get all 1s in foo.
line #5, -9 is out of range. and line #10, %d expects integer, but i have an unsigned integer in printf
even though unsigned foo=~0; might be better, but I agree with |Steve|
My guess would be that lines 7 and 10 would give errors.
Line 7's should be %zu or something like that.