本文介绍了我的控制台输出在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好, 我正在编写使用DLL的代码,该代码应打印到 控制台 一些有用的信息,但由于某种原因,它没有这样做。 环境 解释起来有点复杂但在这里: - 我正在使用一个名为SYMPHONY的C库,我自己编译。 在标准控制台应用程序中使用那个 库时,我得到控制台输出 吧。 - 我在C中为库编写了一个包装器,通过 mex-files将它挂钩到Matlab( 是编译到的C文件DLL,但名称不同) - 这个包装器与库一起用于Matlab 程序。来自内部 Matlab SYMPHONY输出没有出现。 - 这个Matlab程序被编译成.NET组件,当 在Visual Studio中使用的a控制台应用程序显示了上一步中 中缺少的所有信息 。 由于我不明白这里发生了什么,我想 来写 有时出现在控制台中的所有信息(并且 有时候没有) 到一个文件,但是不需要修改我建的 的SYMPHONY库 第一步。 C标准库中有什么东西能帮助我这个吗? 提前致谢, CarlosMartínez 解决方案 CarlosMB写道: 您好, 我正在编写使用DLL的代码hich应打印到 console 一些有用的信息,但由于某种原因它没有这样做。 环境 解释起来有点复杂但在这里: - 我正在使用一个名为SYMPHONY的C库,我自己编译。 在标准控制台应用程序中使用那个 库时,我得到控制台输出 吧。 - 我在C中为库编写了一个包装器,通过 mex-files将它挂钩到Matlab( 是编译到的C文件DLL,但名称不同) - 这个包装器与库一起用于Matlab 程序。来自内部 Matlab SYMPHONY输出没有出现。 - 这个Matlab程序被编译成.NET组件,当 在Visual Studio中使用的a控制台应用程序显示了上一步中 中缺少的所有信息 。 由于我不明白这里发生了什么,我想 来写 有时出现在控制台中的所有信息(并且 有时候没有) 到一个文件,但是不需要修改我建的 的SYMPHONY库 第一步。 C标准库中有什么东西能帮助我这个吗? 在此先感谢, CarlosMartínez Hola Carlos 用西班牙语回答所以这个小组的学生都没有得到它! Lo mejor que puedes hacer es llamar la funci AllocConsole(); cuando comienzas tu programa。 Esto va FORZAR la existencia de una consola。 Probablemente sabes ya que programas utilizando solamente windows no crean una consola。 - jacob navia jacob at jacob point remcomp point fr logiciels / informatique http://www.cs.virginia.edu/~lcc-win32 10月30日,10:11,jacob navia< ; ja ... @ nospam.comwrote: CarlosMB写道: 我正在编写使用DLL的代码,该代码打印到 控制台 一些有用的信息,但由于某种原因它没有这样做。 环境 有点复杂,但在这里: - 我正在使用一个名为SYMPHONY的C库,我自己编译。 在标准控制台应用程序中使用那个 库时,我得到控制台输出 对。 - 我在C中为库编写了一个包装器,通过 mex-files将其挂钩到Matlab(其中 是编译为DLL的C文件,但名称不同) - 这个包装器与库一起用于一个Matlab 程序。来自内部 Matlab的SYMPHONY输出并没有显示出来。 - 这个Matlab程序被编译成一个.NET组件,当 使用 $ b $ Visual Studio中的控制台应用程序显示了上一步中 中缺少的所有信息。 由于我不明白这里发生了什么,我想要 来写 有时出现在控制台中的所有信息(有时候不是b ) 到一个文件,但是不需要修改我所知道的SYMPHONY库> 内置 第一步。 C标准库中有什么东西可以帮助我这个?b $ b这个? 先谢谢, *CarlosMartínez Hola Carlos 用西班牙语回答所以这个小组的学生不懂! Lo mejor que puedes hacer es llamar la funcion AllocConsole(); cuando comienzas tu programa。 Esto va FORZAR la existencia de una consola。 Probablemente sabes ya que programas utilizando solamente windows no crean una consola。 comp.lang.c是一个英语新闻组,发帖应该 限于该语言。 ;-) - Nick Keighley jacob navia写道: CarlosMB写道: >你好, 我正在编写代码使用一个DLL,它应该打印到控制台一些有用的信息,但由于某种原因,它没有这样做。 环境有点复杂,但在这里说: - 我正在使用一个名为SYMPHONY的C库,我自己编译。使用时那个库在一个标准的控制台应用程序中我得到了控制台输出 - - 我在C中为库编写了一个包装器,通过将它挂钩到Matlab中mex-files(它们是编译为DLL的C文件,但名称不同) - 这个包装器与库一起用于Matlab 程序。从内部来看,Matlab的SYMPHONY输出并没有显示出来。 - 这个Matlab程序被编译成一个.NET组件,当它被一个控制台使用时在Visual Studio中的应用程序显示我在上一步中缺少的所有信息。 因为我不明白这里发生了什么,所以我想写入有时出现在控制台中的所有信息(有时候不是)到文件中,但不需要修改我内置的SYMPHONY库 C标准库中有什么东西可以帮助我这个吗? 否。这种情况属于你的窗口系统领域,而不是 C标准。 >提前致谢, CarlosMartínez Hola Carlos 用西班牙语回答所以这个小组的学生不懂! 这太荒谬了。你假设他可以阅读它,只是因为他有一个西班牙裔美国人的名字,你假设我们不能只是因为 $ b而读它$ b - 实际上并不清楚你为什么做出这个假设,但我在 至少有一个反例。从他发来的消息,唯一的语言 你可以肯定他精通英语,而且他看起来很流利。 流利的。 Lo mejor que puedes hacer es llamar la funcion AllocConsole(); 他对此非常具体:他要求一个C标准库 函数。 AllocConsole()不在C标准库中。你没有回答他问的问题,你回答了你自己设计的另一个问题。 cuando comienzas tu programa。 Esto va FORZAR la existencia de una consola。 Probablemente sabes ya que programas utilizando solamente windows no crean una consola。 即使他要求获得特定于Windows的答案,而不是C→标准库答案,你仍然会做他一个更好的服务 通过将他的查询重定向到一个专门讨论他使用的系统的论坛。在那个论坛上,他有比他在这里更好的机会 听取别人的意见,无论你的建议是否有意义。 Hello,I am writing code that uses a DLL which is supposed to print toconsolesome useful information but for some reason it is not doing so. Theenvironmentis a bit complex to explain but here it goes:- I am using a C library called SYMPHONY, which I compiled myself.When using thatlibrary in an standard console application I get the console outputright.- I wrote a wrapper for the library in C to hook it into Matlab viamex-files (whichare C files compiled to DLLs, but with a different name)- This wrapper altogether with the library is used in a Matlabprogram. From insideMatlab the SYMPHONY output doesn''t show up.- This Matlab program is compiled into a .NET component which whenused bya console application in Visual Studio shows all the information i wasmissing inthe previous step.Since I am not understanding what is going on right here I would liketo writeall the information that sometimes appears in the console (andsometimes not)to a file, but without the need to modify the SYMPHONY library that Ibuilt inthe first step.Is there anything in the C standard library that can help me withthis?Thanks in advance,Carlos Martínez 解决方案 CarlosMB wrote:Hello,I am writing code that uses a DLL which is supposed to print toconsolesome useful information but for some reason it is not doing so. Theenvironmentis a bit complex to explain but here it goes:- I am using a C library called SYMPHONY, which I compiled myself.When using thatlibrary in an standard console application I get the console outputright.- I wrote a wrapper for the library in C to hook it into Matlab viamex-files (whichare C files compiled to DLLs, but with a different name)- This wrapper altogether with the library is used in a Matlabprogram. From insideMatlab the SYMPHONY output doesn''t show up.- This Matlab program is compiled into a .NET component which whenused bya console application in Visual Studio shows all the information i wasmissing inthe previous step.Since I am not understanding what is going on right here I would liketo writeall the information that sometimes appears in the console (andsometimes not)to a file, but without the need to modify the SYMPHONY library that Ibuilt inthe first step.Is there anything in the C standard library that can help me withthis?Thanks in advance, Carlos MartínezHola CarlosAnswer in Spanish so the pedants in this group do not get it!Lo mejor que puedes hacer es llamar la funcionAllocConsole();cuando comienzas tu programa. Esto va FORZAR la existencia de unaconsola. Probablemente sabes ya que programas utilizando solamentewindows no crean una consola.--jacob naviajacob at jacob point remcomp point frlogiciels/informatique http://www.cs.virginia.edu/~lcc-win32On 30 Oct, 10:11, jacob navia <[email protected]:CarlosMB wrote: I am writing code that uses a DLL which is supposed to print to console some useful information but for some reason it is not doing so. The environment is a bit complex to explain but here it goes: - I am using a C library called SYMPHONY, which I compiled myself. When using that library in an standard console application I get the console output right. - I wrote a wrapper for the library in C to hook it into Matlab via mex-files (which are C files compiled to DLLs, but with a different name) - This wrapper altogether with the library is used in a Matlab program. From inside Matlab the SYMPHONY output doesn''t show up. - This Matlab program is compiled into a .NET component which when used by a console application in Visual Studio shows all the information i was missing in the previous step. Since I am not understanding what is going on right here I would like to write all the information that sometimes appears in the console (and sometimes not) to a file, but without the need to modify the SYMPHONY library that I built in the first step. Is there anything in the C standard library that can help me with this? Thanks in advance, *Carlos MartínezHola CarlosAnswer in Spanish so the pedants in this group do not get it!Lo mejor que puedes hacer es llamar la funcionAllocConsole();cuando comienzas tu programa. Esto va FORZAR la existencia de unaconsola. Probablemente sabes ya que programas utilizando solamentewindows no crean una consola.comp.lang.c is an English language news group and posting shouldbe restricted to that language.;-)--Nick Keighleyjacob navia wrote:CarlosMB wrote:>Hello,I am writing code that uses a DLL which is supposed to print toconsolesome useful information but for some reason it is not doing so. Theenvironmentis a bit complex to explain but here it goes:- I am using a C library called SYMPHONY, which I compiled myself.When using thatlibrary in an standard console application I get the console outputright.- I wrote a wrapper for the library in C to hook it into Matlab viamex-files (whichare C files compiled to DLLs, but with a different name)- This wrapper altogether with the library is used in a Matlabprogram. From insideMatlab the SYMPHONY output doesn''t show up.- This Matlab program is compiled into a .NET component which whenused bya console application in Visual Studio shows all the information i wasmissing inthe previous step.Since I am not understanding what is going on right here I would liketo writeall the information that sometimes appears in the console (andsometimes not)to a file, but without the need to modify the SYMPHONY library that Ibuilt inthe first step.Is there anything in the C standard library that can help me withthis?No. That kind of thing is in the domain of your windowing system, notthe C standard.>Thanks in advance, Carlos MartínezHola CarlosAnswer in Spanish so the pedants in this group do not get it!That''s ridiculous. You''re assuming he can read it, just because he''s gota Hispanic name, and you''re assuming that we can''t read it just because-- it''s not actually clear why you''ve made that assumption, but I''m atleast one counterexample. From the message he sent, the only languageyou can be certain that he is fluent in is English, and he seems fairlyfluent in it.Lo mejor que puedes hacer es llamar la funcionAllocConsole();He was very specific about this: he asked for a C standard libraryfunction. AllocConsole() is not in the C standard library. You did notanswer the question he asked, you answered a different question of yourown devising.cuando comienzas tu programa. Esto va FORZAR la existencia de unaconsola. Probablemente sabes ya que programas utilizando solamentewindows no crean una consola.Even if he had asked for a Windows-specific answer, rather than a Cstandard library answer, you would still have done him a better serviceby redirecting his inquiry to a forum devoted to the kind of system he''susing. In that forum, he''d have a better chance than he has here ofhearing from someone else whether or not your advice makes any sense. 这篇关于我的控制台输出在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-05 03:50