
I tried to insert this:
into LyX, but all I get is this:
I tried many different programs to copy the code from, and also tried to convert my source to different codings, but nothing works. Please help, I need to get this code into my document

NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Code: Select all
\begin{lstlisting}[language=C, frame=single, felxiblecolumns=true]
void main(void)
{
...
}
\end{lstlisting}
Code: Select all
\lstinputlisting[firstline=17,lastline=20]{prog.c}
Code: Select all
\lstdef{part1}{mycfile.cpp}{1}{5}
Code: Select all
\lstuse{part1}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p