Questions tagged [flags]

Flags are atomic data structures used to identify state in a program.

A flag field is an integer interpreted as a sequence of boolean bits, each called a flag. A single flag has two possible states: 0, representing false or off, and 1, representing true or on.

This tag can be used for problems related to .

Source

Wikipedia

1473 questions
-2
votes
2 answers

Forks and Signal in C

Could someone help me step through the following C code to understand what the output should be. int x = 0; pid_t pid; int flag=1; void handler1(int sig) { x=x+1; printf("%d\n",x); fflush(stdout); exit(0); } void handler2(int sig)…
user3610554
  • 23
  • 1
  • 5
-2
votes
3 answers

How to read the interrupt flag in x86 processor

Are there any assembly instructions to let us directly read the interrupt flag in processor Flags register in Assembly? Is it possible to read the Interrupt Flag in C/C++ ?
Javad Yousefi
  • 2,250
  • 4
  • 35
  • 52
-2
votes
4 answers

How to make hex vals acceptable to the compiler?

I'm trying to use the code at http://www.pinvoke.net/default.aspx/coredll/playsound.html It causes several err msgs, though, namely: "Unexpected character '×'" 26 times. So, I tried changing the vals to verbatim strings, like so: SND_SYNC =…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
-2
votes
1 answer

How to provide flags to ruby script like -v , -o and place code accordingly?

I have created one ruby script that I want to run with some flags on console say -v flag prints output on console and -o stores output in new file with file name I am taking from console using gets() My code has following structure: puts "Enter…
Akash Panchal
  • 205
  • 1
  • 6
  • 20
-3
votes
1 answer

How do I look for nonzero values

How do I look for a non-zero value in “things” within python and create flags. If there not is a non-zero value then I have to create a timeout flag. If there is a Non-zero then I need to clear the timeout flag return things def look_things(self,…
-3
votes
3 answers

SQL get all possible combination of numbers

i have a table like this | Number | ---------- | 1 | | 2 | | 4 | | 8 | | 16 | | 32 | can create a function that will return that | 1 | 2 | 3 | 4 | 5 | 6 | sum | -------------------------------- | 1 | | | …
GomuGomuNoRocket
  • 771
  • 2
  • 11
  • 37
-3
votes
1 answer

autohotkey: code read from INI

Hi all The following code from here: https://autohotkey.com/board/topic/1359 ... g-winmove/ it's for resize-a-window-using-winmove My question is: Is it possible to divide the code into two files? Part 1 into "*.ahk" Part 2 into "*.ini" I mean: Can…
asad41163
  • 49
  • 11
-3
votes
1 answer

How to make a makefile?

I am trying to produce a simple makefile for a project, but having trouble because I am still getting used to them. I have a file folder containing 3 separate files, header file LinkedListAPI.h, LinkedListAPI.c and StructListDemo.c. Have to use the…
waffles
  • 71
  • 1
  • 2
  • 7
-3
votes
1 answer

Facing problems with Function questions?

I'm facing a problem with this question: Write a function void: bool tossCoin (bool& flag); The function returns true to indicate head (45% chance), false for tail (45% chance). There is 10% chance that the toss will fail, example not landing on a…
-3
votes
1 answer

Error: no matching function for call to BufferIO::open(const char*&, int)

//Displayed Error message in eclipse cdt. - Syntax error - candidate is: - no matching function for call to ‘BufferIO::open(const char*&, int)’ //BufferIO::BufferIO(const char* filename) { // trying to open a a file if(…
fab90
  • 1
-4
votes
1 answer

Masks bits of array members

Can you direct me where is my problem here? I am trying to test values of an array. Every value presents 16 bits (flags) and I need to check if the flag is set or not. My current output is shown below and also the expected output. #include…
MhdBanat
  • 13
  • 4
-4
votes
9 answers

arrays and index

How can I enter numbers into an array such that duplicate entries are ignored? For example, if I put 6 and then 3 into the array, attempting to then insert 6 into the the array should cause 6 to be rejected (since it is already in the…
jboy
  • 11
  • 3
-4
votes
1 answer

Check if ZF is 0 or 1?

I used the int 16h interrupt, and I want to check if keystroke is available or not. So I want to check what value the Zero Flag has - how can I do it?
Yair Haimson
  • 1
  • 1
  • 3
-4
votes
1 answer

Prime number generator using pointers, flags and function calls (C)

The program (c code) gets a minimum and maximum value from the user to then determine whether all of the numbers in between are prime or not. If the number is not prime, the program must also tell the user one set of factors of that number. I'm…
Curtis Negele
  • 15
  • 2
  • 5
-5
votes
2 answers

Why do I ge a segmentation Fault when I run this function?

Why do I get a segmentation fault when I send the flags -h or -H. bool parse_command(int argc, char **argv, bool *header, char **fileName) { if (!argv) return false; bool *flagh = false; bool *flagH = false; char *options…
1 2 3
98
99