Yes / No query - Help please

Yes / No query - Help please

Post by NewGeneration17 on Sun Sep 07, 2014 8:33 am
([msg=83378]see Yes / No query - Help please[/msg])

Hey Guys,

i'm new with learning the programming language "C". I'm learning with a book. But now i want to make something, what isn't written in the book. As a "Yes / No query".
Please help me anybody with a easy uncomplicated script which is done with the Header files:
stdio.h
string.h


Thanks before guys


Btw. Console Application
NewGeneration17
New User
New User
 
Posts: 1
Joined: Sun Sep 07, 2014 8:28 am
Blog: View Blog (0)


Re: Yes / No query - Help please

Post by BB3235 on Sun Sep 07, 2014 9:32 am
([msg=83379]see Re: Yes / No query - Help please[/msg])

Yes and No fields contain boolean data (1 for Yes and 0 for No if I remember correctly) I think that you could try something like this: 8-)
<Eq><FieldRef Name='Enteryourstory'/><Value Type='Integer'>0</Value></Eq>
Let me know if this helped you... :)
Also correct me if I am wrong. It has been a while since I have worked with this.

Brenton
User avatar
BB3235
New User
New User
 
Posts: 19
Joined: Mon Aug 25, 2014 1:07 pm
Blog: View Blog (0)


Re: Yes / No query - Help please

Post by cyberdrain on Sun Sep 07, 2014 1:14 pm
([msg=83383]see Re: Yes / No query - Help please[/msg])

Brenton, you might want to use the [ code ] [ /code ] tags next time ;) Also, he's asking for C code (which is this subforum), not HTML.

Booleans are the way to go; you could do a string comparison from user input with Yes/Y/yes/y to set a default false boolean to true.
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)


Re: Yes / No query - Help please

Post by Goatboy on Sun Sep 07, 2014 4:02 pm
([msg=83392]see Re: Yes / No query - Help please[/msg])

Assume that everything I say is or could be a lie.
19JAW6GabFHqe9yD9rr26QL3W3V2pNitbD
User avatar
Goatboy
Expert
Expert
 
Posts: 2863
Joined: Mon Jul 07, 2008 9:35 pm
Blog: View Blog (0)


Re: Yes / No query - Help please

Post by BB3235 on Mon Sep 08, 2014 10:20 am
([msg=83406]see Re: Yes / No query - Help please[/msg])

cyberdrain wrote:Brenton, you might want to use the [ code ] [ /code ] tags next time ;) Also, he's asking for C code (which is this subforum), not HTML.

Booleans are the way to go; you could do a string comparison from user input with Yes/Y/yes/y to set a default false boolean to true.

Thank you for correcting me m8! Like I said its been a while. :D
User avatar
BB3235
New User
New User
 
Posts: 19
Joined: Mon Aug 25, 2014 1:07 pm
Blog: View Blog (0)


Re: Yes / No query - Help please

Post by centip3de on Mon Sep 08, 2014 12:21 pm
([msg=83407]see Re: Yes / No query - Help please[/msg])

NewGeneration17 wrote:Hey Guys,

i'm new with learning the programming language "C". I'm learning with a book. But now i want to make something, what isn't written in the book. As a "Yes / No query".
Please help me anybody with a easy uncomplicated script which is done with the Header files:
stdio.h
string.h


Thanks before guys


Btw. Console Application


I'm assuming you mean you want a prompt like, "Would you like to continue? [Y/N]: ". There is no builtin way to do this in the language. There's no "yesOrNo" function that will output all that for you, you have to do it manually using input/output functions and if/case statements. Something like this (except not this because buffer overflows):

Code: Select all
char input [2];                                    //Variable to store the answer
printf("Would you like to continue? [Y/N]: ");  //Prompt
scanf("%s", input);                            //Getting user input and storing it in 'input'
if(input == "Y" || input == "y")
{
    /* They said yes. Do something. */
}
else
{
    /* They said no. Do something else. */
}
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Addict
Addict
 
Posts: 1479
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: Yes / No query - Help please

Post by cyberdrain on Tue Sep 09, 2014 7:00 am
([msg=83426]see Re: Yes / No query - Help please[/msg])

centip3de wrote:except not this because buffer overflows

So doing a size/length check first would solve it?
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)


Re: Yes / No query - Help please

Post by -Ninjex- on Tue Sep 09, 2014 9:31 am
([msg=83452]see Re: Yes / No query - Help please[/msg])

cyberdrain wrote:
centip3de wrote:except not this because buffer overflows

So doing a size/length check first would solve it?


You should use that in compliance with canary values and non-executable stacks
image
For those that know
K: 0x2CD8D4F9
User avatar
-Ninjex-
Moderator
Moderator
 
Posts: 1691
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Yes / No query - Help please

Post by cyberdrain on Tue Sep 09, 2014 10:29 am
([msg=83455]see Re: Yes / No query - Help please[/msg])

Let me see if I get this: only if you're using a guessable/non-random canary value you could use ROP to defeat non-executable memory to execute arbitrary code? Is there some other way to more easily prevent these types of buffer overflows? I was looking into buffer overflows and protection against it in Python, it shouldn't have any (except of course using ctypes), but this stuff is interesting :)
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)


Re: Yes / No query - Help please

Post by centip3de on Tue Sep 09, 2014 2:05 pm
([msg=83464]see Re: Yes / No query - Help please[/msg])

cyberdrain wrote:So doing a size/length check first would solve it?


That or just allocating enough memory using one of the 'llocs (malloc/calloc/alloc) for the length of the string provided.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Addict
Addict
 
Posts: 1479
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Next

Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests