Can I write IO statements inside a dll?
This is a newbie question. Can I write statements like printf
or ope开发者_开发百科n a file inside a dll?
Opening a file is certainly possible in all cases.
However, using printf()
depends on whether the executable calling your DLL is a console program or not. If it's a GUI program, then there is nowhere for the printf()
output to go, so it will not appear. If it's a console program, you'll see the output on the console.
Your question and its title are asking two different questions. But the answer to the question body is yes -- libraries can certainly use those functions.
printf
might not do anything though, depending on whether standard output has been closed by the program using the library.
精彩评论