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

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

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/

Telling when file was last accessed in C [duplicate]

This question already has an answer here:
Determining if file has been copied or not in C [closed]
(1 answer)
Closed 9 years ago.
In Windows, if you go to a file's properties it shows the last access time right under the time last modified. This changes when I copy it.
How do I view this in C?
You can use the GetFileTime() function to get it. This MSDN article has more details about file times.
The portable way of getting the last modified timestamp is by using fstat or stat. If you want to go the Windows-only route (by directly calling a Windows API), see #xxbbcc's answer.
See How can I get a file's size in C++? for a short piece of sample code that uses stat/fstat - only change for your purpose is that you'll want to read the time_t st_mtime field.

code won't compile generates infinite 2222s [duplicate]

This question already has answers here:
C code won't finish running
(4 answers)
Closed 9 years ago.
The purpose of this code is to construct a char Hadamard matrix of the size of my choosing.
This question is related to a previous question I asked. The answer given there was an integer not char matrix, but the code here is pretty much the same format.
The code compiles but when executed it doesn't finish and I don't know why. When executed infinite 2's are printed.
I get the same result when swap the dynamic Hadamard matrix section for one of a fixed size.
Note: I've no idea what your program does, but obviously this is wrong. You failed to actually change the control variable in your for-loop (which can be done in the final expression or the loop body itself).
Change this:
for (ind=1;ind<=sizeH;ind*2)
to this:
for (ind=1;ind<=sizeH;ind*=2) // << note *=

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

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.

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

Resources