Reset and Shutdown in pure DOS(not Command prompt in Windows) [duplicate] - c

This question already has answers here:
Shutdown the computer using assembly
(10 answers)
Closed 9 years ago.
In command prompt within Windows restart and shutdown are ok via internal command- shutdown.exe. But for pure DOS, is there any way to achieve the same goals ?
We can assume the platform is Intel chipset and I guess maybe accessing chipset registers is required...
Could anyone give some comments ? Thanks !

BITD the shortest program ever was reboot.com, a 5 byte program that was a jump to the reset vector at FFFF:0. Not sure if this meets your needs, but thought I'd mention it.

Related

Is there a way to clear terminal? [duplicate]

This question already has answers here:
console print w/o scrolling
(7 answers)
Closed 1 year ago.
I have a program that is a simulation, it updates constantly and writes messages in terminal, however, this causes the terminal to constantly scroll with new lines. I am wondering if there is a way to make terminal print lines and then clear after 10 seconds and then update?
Many terminals accept special escape codes allowing the programmer to move the cursor, set the colour and many more functions.
To use it good people wrote the ncurses library https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/

How do I do a milisecond delay in a .bat file [duplicate]

This question already has answers here:
delay a batch file in under a second?
(7 answers)
Closed 2 years ago.
I was wondering if there is a delay command in a batch file that can delay for less than a second (like 0.2 seconds). As of right now I only know of the timeout (seconds) which can only delay for a minimum of 1 second. I would appreciate any help :-)
As i know, there isn't a very "good" way of doing this. Some might suggest using the ping command, which is actually possible to give miliseconds of delay, but this is using the wrong tool for the wrong place.
It would be must better to write a code in C (or any other languages with this feature) and run it on batch. Try the program at the link below.
https://www.elifulkerson.com/projects/millisleep.php

What does `register` do in GStreamer [duplicate]

This question already has answers here:
"register" keyword in C?
(19 answers)
Closed 8 years ago.
I was reading some gstreamer code and fell on this line
register int i;
Does anyone know what the register keyword does ?
Another SO question has already answered this.
Answer From Brian Knoblauch:
It's a hint to the compiler that the variable will be heavily used and
that you recommend it be kept in a processor register if possible.
Most modern compilers do that automatically, and are better at picking
them than us humans. :-)
So, essentially, it assures the programmer that the compiler will know that the variable will be utilized numerous times and to keep that variable in the CPU register. As stated in the other answer, most compilers do this automatically.

What tool do you use to metric performance? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
What's your favorite profiling tool (for C++)
Instead of do it directly inside the C code, I want a some tool to do it for me. e.g, given some C code, it returns how long time it's was executed. Something like LinqPad and most client that given a SQL-query,it returns how time the query was executed in *conds.
You many try
1)GNU profiler (gprof) for function level profiling
http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html#SEC2
2)For overall time statistics you may use the command,
time
Example
3)You can also try parsing the files in /proc (/proc/[pid]/stat) for a particular process,
proc manual

How to break on access of a specific global variable in gdb? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Can I set a breakpoint on 'memory access' in GDB?
I want to trace how a specific variable is initialized,
can gdb do this kind of job?
The gdb command watch <expr> sets a breakpoint on write, rwatch on read, and awatch on read or write. You can use them as you would with breakpoints, with two considerations:
You can't use gdb expressions in them (like $esp+...)
You need support for them. Software support is much, much slower than hardware. To find out if your gdb can use hardware watchpoints, see the output of show can-use-hw-watchpoints.

Resources