简体   繁体   English

将C代码的输出重定向为MySQL服务器的输入

[英]Re-directing output of C code as input to MySQL server

I want to compile a C program related to databases in Windows. 我想在Windows中编译与数据库相关的C程序。 I have installed MySQL. 我已经安装了MySQL。

What I actually want to do is re-direct the output of my C code as an input command for my database. 我实际上想做的是将C代码的输出重定向为数据库的输入命令。

I have done this thing in Ubuntu having followed the below given link: 我已经在Ubuntu中完成了以下操作:

PS Does it require for me to compile the code in Command Prompt (because that's how I access the MySQL server). PS是否需要我在命令提示符中编译代码(因为这就是我访问MySQL服务器的方式)。

How do I do it? 我该怎么做?

No - you can compile the code anyhow. 否-您可以以任何方式编译代码。

If you want to redirect output, it's easiest to make the program a console application (which can be compiled from the IDE or from the command line). 如果要重定向输出,最简单的方法是将该程序设置为控制台应用程序(可以从IDE或命令行进行编译)。

Then you pipe the output of the program to the mysql command line client. 然后,将程序的输出通过管道传递到mysql命令行客户端。

yourprogram | mysql --user=user_name --password=your_password db_name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM