CBMC
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
c
d
e
f
g
j
l
m
r
t
w
Functions
a
c
d
f
g
r
t
w
Typedefs
Enumerations
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
i
k
l
m
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
Related Symbols
b
c
d
e
g
i
j
m
n
o
s
t
u
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
w
y
Typedefs
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerations
_
a
b
c
d
f
g
i
l
m
p
r
s
t
u
v
w
Enumerator
_
a
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Macros
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
file_converter.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Convert file contents to C strings
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
11
12
#include <fstream>
// IWYU pragma: keep
13
#include <iostream>
14
#include <string>
15
16
static
void
convert_line
(
const
std::string &line)
17
{
18
std::cout <<
"\""
;
19
20
for
(std::size_t i = 0; i < line.size(); i++)
21
{
22
const
char
ch
= line[i];
23
if
(
ch
==
'\\'
)
24
std::cout <<
"\\\\"
;
25
else
if
(
ch
==
'"'
)
26
std::cout <<
"\\\""
;
27
else
if
(
ch
==
'\r'
||
ch
==
'\n'
)
28
{
29
}
30
else
if
((
ch
& 0x80) != 0)
31
{
32
std::cout <<
"\\x"
<< std::hex << (
unsigned
(
ch
) & 0xff) << std::dec;
33
}
34
else
35
std::cout <<
ch
;
36
}
37
38
std::cout <<
"\\n\"\n"
;
39
}
16
static
void
convert_line
(
const
std::string &line) {
…
}
40
41
int
main
(
int
argc,
char
*argv[])
42
{
43
std::string line;
44
45
for
(
int
i = 1; i < argc; ++i)
46
{
47
std::ifstream
input_file
(argv[i]);
48
49
if
(!
input_file
)
50
{
51
std::cerr <<
"Failed to open "
<< argv[i] <<
'\n'
;
52
return
1;
53
}
54
55
while
(
getline
(
input_file
, line))
56
convert_line
(line);
57
}
58
59
return
0;
60
}
41
int
main
(
int
argc,
char
*argv[]) {
…
}
ait
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition
ai.h:562
main
int main()
Definition
example.cpp:18
convert_line
static void convert_line(const std::string &line)
Definition
file_converter.cpp:16
src
ansi-c
file_converter.cpp
Generated by
1.9.8