User Controls
Posts by aldra
-
2017-01-09 at 1:43 AM UTC in Who were you in your past life?some dong probably
-
2017-01-09 at 1:40 AM UTC in Since men can never hit women...
Originally posted by SCronaldo_J_Trump thats a pretty yummy looking cat.
come back and check when you're not tweaking -
2017-01-09 at 1:40 AM UTC in Since men can never hit women...
Originally posted by Lanny It says "sex determination system" right there though… are you denying the sex/gender distinction or are you criticizing the (obviously minority, and not here represented) position that sex is a social construct?
since there's a biological basis for sex, claiming a gender contradictory to that is utterly meaningless. it's ironic how the vast majority of those people eschew labels and roles until they start making them up themselves. -
2017-01-09 at 1:16 AM UTC in Q̇uick Ċ Q̇uestion
Originally posted by SBTlauien I had tried this and some other things. None worked. The problem, like Lanny said, is that "AF_INET", "SOCK_STREAM", and all of the others, are just integers. I think the compiler just uses them as a reference. So getting my char* to one of those integers is going to be easiest just leaving my long if-elseif statement. I thought about a switch-case but it was more of a curiosity.
regardless of their actual data type, commandline arguments are stored as strings. argv[1] is a pointer to a string (a character array). in this case your socket() function is likely expecting an integer but is getting a character array so is having trouble. you'll want to pull the integer value out of the string, easiest ways are to either cast the variable to a different type or use math to convert the character array to an int.
let's assume the following works to load the commandline arguments as strings:
int main(int argc, char ** argv)
{
char firstParam[256];
char secondParam[256];
strncpy(firstParam,argv[1]);
strncpy(secondParam,argv[2]);
to cast, or convert variables, you could do this (could be done more cleanly but I figure this is easier to read):
int main(int argc, char ** argv)
{
char firstParam[256];
char secondParam[256];
strncpy(firstParam,argv[1]);
strncpy(secondParam,argv[2]);
int intFirstParam=atoi(firstParam);
int intSecondParam=atoi(secondParam);
Honestly not sure how well atoi works but eh.
If you want to use raw math, try the following:
int main(int argc, char ** argv)
{
char firstParam[256];
char secondParam[256];
int intFirstParam;
int x=0;
strncpy(firstParam,argv[1]);
int baseVal=0;
for(x=0;x<256;x++)
{
if(firstParam[x]>47 && firstParam[x]<58)
{
firstParam+=(10^baseVal)*firstParam[x];
baseVal++;
}
elseif(firstParam[x]==0)
{
break;
}
}
reason that approach works is because C stores strings as arrays - each character is an ASCII value and the end of the string is marked with a 0 (null terminator). example:
char youAreAFaggot[16] = "faggot";
youAreAFaggot (chars) = {'f', 'a', 'g', 'g', 'o', 't', "\0"}
youAreAFaggot (ints) = {102, 97, 103, 103, 111, 116, 0}Next question…
will look at that in a few
***just realised I'm calculatiing decimals backwards. fuck. will fiix later
Post last edited by aldra at 2017-01-10T05:49:20.092764+00:00 -
2017-01-06 at 5:51 AM UTC in Q̇uick Ċ Q̇uestion
-
2017-01-06 at 5:16 AM UTC in BAC
Originally posted by Bill Krozby I'm almost tempted to buy the same model they use and do my own study , for science!
lol I considered this back when I drank heaps, they're fucking expensive and fiddly though -
2017-01-06 at 5:15 AM UTC in BAC
Originally posted by Bill Krozby I just don't see how your breath can tell how much alcohol is in your blood. I can see how it can tell how much is in your lungs/mouth lol.
yeah it picks up the saliva on your breath, and determines the amount of alcohol inside it. when you've got alcohol in your blood the same levels show up in your saliva I'd assume, but I've never really looked into the biology behind it -
2017-01-06 at 4:37 AM UTC in BACthose handheld testers need to be calibrated daily and aren't accurate enough to be relied upon for fines, court proceedings etc.. the proper blood/saliva tests they have at the police station are, but they're too bulky and expensive to be used at checkpoints.
they basically just use the portable testersto determine whether it's worth bringing you back to the station to be tested/charged.
as for being able to 'beat' them, there are a bunch of tricks but nobody's been able to say for sure which ones work and which don't - the cops put out a lot of disinfo to stop people from trying -
2017-01-06 at 2:46 AM UTC in Zoklet archive
Originally posted by -SpectraL Implying that I have something to be shameful about. Your "strawman" claim doesn't really carry much weight without demonstrative examples.
no, I was referring to malice not being able to feel shame. the 'you should know better' part was about you willingly associating with these people for what, close to 30 years? -
2017-01-06 at 2 AM UTC in single moms suck assI have this urge to pull her nosering
-
2017-01-06 at 1:59 AM UTC in crabby penguins
Originally posted by the holy ghost neopets
I call it that too -
2017-01-06 at 12:56 AM UTC in Zoklet archiveyou of all people should know it's not possible to shame someone who does not feel shame, spectral
-
2017-01-05 at 4:45 PM UTC in Q̇uick Ċ Q̇uestion
Originally posted by SBTlauien I'd like start my program by running a command similar to this…
"./my program AF_INET SOCK_STREAM"
Where "AF_INET" and "SOCK_STREAM" are arguments into my program and are also used as arguments to socket().
oh right. if they're integers you can pass them directly, if they're strings no.
int main(int argc, char ** argv) {
socket_fd = socket(argv[1], argv[2], 0);
.....
...
.
in that code argc is an integer that contains the number of arguments passed and argv is a pointer to a pointer (**) to the first character in a string.
in c(99) you will normally create a fixed-length character array to store a string in -
char myString[12] = 'word';
if you can't or don't want to allocate fixed memory manually you need to create a pointer to where to store the string (by default it allocates random unused memory):
char * myString = 'word';
I haven't done any C programming in quite a while so what you're doing seems a bit problematic. you can't pass the strings directly to your socket() function because they're in the form of pointers, and you can't pass the location of the data to it because it's coded to accept a string, not a location. I'm assuming you're using the inbuild socket() function so you can't change what it expects as parameters.
This link touches on what I mean:
https://www.tutorialspoint.com/cprogramming/c_passing_pointers_to_functions.htm
I think you SHOULD be able to copy the string from the pointer into a character array and pass that to the socket thus:
int main(int argc, char ** argv)
{
char firstParam[256];
char secondParam[256];
strncpy(firstParam,argv[1]);
strncpy(secondParam,argv[2]);
socket_fd = socket(firstParam, secondParam, 0);
} -
2017-01-04 at 11:32 PM UTC in Q̇uick Ċ Q̇uestionit might just be too early in the morning but I'm not following what you're trying to accomplish
-
2017-01-04 at 4:09 AM UTC in People on this forum/zok/totse/sanc that deserve notice for being an ok guyoh right, I was thinking of this:
-
2017-01-04 at 3:48 AM UTC in People on this forum/zok/totse/sanc that deserve notice for being an ok guy
-
2017-01-04 at 3:46 AM UTC in I am very smart
-
2017-01-04 at 2:54 AM UTC in Trying to get back into the medical field
Originally posted by Bill Krozby towards being a medical assistant/ lvn / physical therapist
honestly seems like a pretty good fit for you as long as you can tone down the drinking at work and talking shit to customers. as I understand it having a felony really limits your employment opportunities in the US, but mid-level medical jobs (what's an LVN though, some kind of nurse?) are always in demand. -
2017-01-03 at 11:20 PM UTC in People on this forum/zok/totse/sanc that deserve notice for being an ok guy
Originally posted by Malice I wonder if anyone has ever started a service around this. "I will give you HIV in exchange for…". Hmm, the clientele it would attract wouldn't have much purchasing power…
https://aidsetc.org/blog/bug-chasers-gay-men-and-intentional-pursuit-hiv-narrative-analysis -
2017-01-03 at 1:53 PM UTC in People on this forum/zok/totse/sanc that deserve notice for being an ok guyhts is a total fag though regardless