I need to type C code into LaTeX and send it electronically to my lecturer. I already know the verbatim and listings package, but they do not work for my purpose. (or I do not know how to use them properly)
The thing is that my lecturer will copy-paste my code and test it on his C compiler. When I use verbatim or listings, I have two major problems:
- When my code is on one long line, it goes beyond the page. (for example printf(...) can be longer than one line and yet I cannot "cut" it)
- When I copy paste some code from the PDF onto my own compiler, it changes the structure of the code (for example it adds spaces between letters, changes the ", etc.)
Does anyone have an idea on how to solve these problems ?
Thank you very much !