Visual Studio 的 C 支持 #pragma message() 宏可以用来输出一些信息。于是编写一个代码进行测试:
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/ShellCEntryLib.h>
/***
Print a welcoming message.
Establishes the main structure of the application.
@retval 0 The application exited normally.
@retval Other An error occurred.
***/
INTN
EFIAPI
ShellAppMain (
IN UINTN Argc,
IN CHAR16 **Argv
)
{
#pragma message (__FILE__)
return(0);
}
@echo off
set "t=%time%"
::You code start here
::You code end here
set "t1=%time%"
if "%t1:~,2%" lss "%t:~,2%" set "add=+24"
set /a "times=(%t1:~,2%-%t:~,2%%add%)*3600+(1%t1:~3,2%%%100-1%t:~3,2%%%100)*60+(1%t1:~6,2%%%100-1%t:~6,2%%%100)"
echo Time Used %times% Seconds
pause
上述代码合在一起进行测试:
@echo off
set "t=%time%"
::You code start here
CHOICE /T 3 /C ync /CS /D y
::You code end here
set "t1=%time%"
if "%t1:~,2%" lss "%t:~,2%" set "add=+24"
set /a "times=(%t1:~,2%-%t:~,2%%add%)*3600+(1%t1:~3,2%%%100-1%t:~3,2%%%100)*60+(1%t1:~6,2%%%100-1%t:~6,2%%%100)"
echo Time Used %times% Seconds
pause
Sub Merge_Sheets()
'Insert a new worksheet
Sheets.Add
'Rename the new worksheet
ActiveSheet.Name = "ProfEx_Merged_Sheet"
'Loop through worksheets and copy the to your new worksheet
For Each ws In Worksheets
ws.Activate
'Don't copy the merged sheet again
If ws.Name <> "ProfEx_Merged_Sheet" Then
ws.UsedRange.Select
Selection.Copy
Sheets("ProfEx_Merged_Sheet").Activate
'Select the last filled cell
ActiveSheet.Range("A1048576").Select
Selection.End(xlUp).Select
'For the first worksheet you don't need to go down one cell
If ActiveCell.Address <> "$A$1" Then
ActiveCell.Offset(1, 0).Select
End If
'Instead of just paste, you can also paste as link, as values etc.
ActiveSheet.Paste
End If
Next
End Sub
#include <Wire.h>
byte i2c_rcv=0; // data received from I2C bus
void setup() {
Wire.begin(0x08); // join I2C bus as Slave with address 0x08
// event handler initializations
Wire.onReceive(dataRcv); // register an event handler for received data
Wire.onRequest(dataRqst); // register an event handler for data request
Serial.begin(115200);
}
void loop() {
}
//received data handler function
void dataRcv(int numBytes) {
Serial.print("Slave Received ");
Serial.print(numBytes);
Serial.println("Bytes");
while (Wire.available()) { // read all bytes received
i2c_rcv = Wire.read();
Serial.print("[");
Serial.print(i2c_rcv);
Serial.print("]");
}
Serial.println("");
}
// requests data handler function
void dataRqst() {
Wire.write(i2c_rcv); // send potentiometer position
Serial.print("Slave send ");
Serial.print(i2c_rcv,HEX);
}