Skip to content

Instantly share code, notes, and snippets.

@pmachapman
Created February 2, 2022 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmachapman/f494b76341c18ed88f830bb871b8c616 to your computer and use it in GitHub Desktop.
Save pmachapman/f494b76341c18ed88f830bb871b8c616 to your computer and use it in GitHub Desktop.
Drag and drop a file onto this script to create a text file containing the escape codes to use in a C++ string literal
Const ForWriting = 2
data = ""
fileName = WScript.Arguments.Item(0)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(fileName)
Do Until f.AtEndOfStream
buf = f.Read(1)
data = data & "\x" & Hex(Asc(buf))
Loop
f.Close
Set f = Nothing
Set f = fso.CreateTextFile(fileName & ".txt", True, False)
f.Write(data)
f.Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment