import os import argparse import sys import filecmp
def replace_if_changed(new, old): '''
Compare contents and only replace if changed to avoid triggering a rebuild. ''' try:
changed = not filecmp.cmp(new, old, shallow=False) except FileNotFoundError:
changed = True if changed:
os.replace(new, old) else:
os.remove(new)
parser = argparse.ArgumentParser()
parser.add_argument('--array-name', help='The name of the array variable')
parser.add_argument('--output', metavar='STRING', help='Output filename',
default=None)
parser.add_argument('input', metavar='FILE', help='The input file',
type=argparse.FileType('r'))
with open(output, 'w') as f:
f.write('static const char {}[] = {{\n'.format(args.array_name)) for line in args.input: for ch in line:
f.write(' 0x{:02x},\n'.format(ord(ch)))
f.write('};')
if args.output isnotNone:
replace_if_changed(output, args.output)
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-07-02)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.