我需要通过一些转换将数据库表数据写入文本文件。从表中检索数据有两个步骤,即表输入和数据库连接。除了“外部连接?”之外,我看不出它们之间有太大区别。选项(如果我理解错误请纠正我)。那么使用哪个更好呢?
环境:
数据库:甲骨文
Pentaho Spoon:5.3.*(社区版)
提前致谢。
我已将文本文件内容加载到std :: string.我想从加载的字符串中删除空格.
方法1:
在循环语句中使用string.find()扫描字符串,并使用string.erase()删除空格;
方法2:
使用循环语句中的string.find()扫描字符串,并使用string.append()将非空白字符复制到新的string()变量;
方法3:
使用循环语句中的string.find()扫描字符串,并使用string.replace()将非空白字符复制到新字符串(size_t n,char c)变量;
方法4:
分配char*(使用malloc [源字符串的大小])
在循环语句中使用string.find()扫描字符串,并使用strcpy将非空白字符复制到char*变量,然后使用strcat();
最后将char*复制到一个新的字符串
free char*
我必须添加两种类型的图形项(QGraphicsRectItem和QGraphicsEllipseItem)的倍数QGraphicsScene(添加到QGraphicsView).每个图形项都应该能够与鼠标和键盘事件进行交互.所以最初我设计的课程如下.
class myQGraphicsRectItem : public QGraphicsRectItem
{
public:
explicit myQGraphicsRectItem();
private:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void keyPressEvent(QKeyEvent *event);
void focusOutEvent(QFocusEvent *event);
//Many events goes here
void fnCreateRect();
};
class myQGraphicsRectItem : public QGraphicsEllipseItem
{
public:
explicit myQGraphicsRectItem();
private:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void keyPressEvent(QKeyEvent *event);
void focusOutEvent(QFocusEvent *event);
//Many events goes here
void fnCreateCircle();
};
Run Code Online (Sandbox Code Playgroud)
要知道如何避免重复事件声明和定义,我会阅读以下答案:
最后设计了如下课程.
template <class T>
class myQGraphicsRectItem : public QGraphicsRectItem , public QGraphicsEllipseItem{ …Run Code Online (Sandbox Code Playgroud) 场景:
在Netbeans IDE中创建的AC应用程序,包含以下两个文件:
some_function.c
#include <stdio.h>
int function_1(int a, int b){
printf("Entered Value is = %d & %d\n",a,b);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
newmain.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
//function_2(); //Error //function name not allowed
function_1();
function_1(1);
function_1(1,2);
return (EXIT_SUCCESS);
}
Run Code Online (Sandbox Code Playgroud)
当在C程序中学习头文件的需要时,我尝试了上述应用程序(原样).它被编译并给出如下输出
输入值= 4200800&102
输入值= 1和102
输入值= 1和2
问题1 :(我意识到,在开始阶段,理解链接器程序的过程很难,因此我问这个问题.)我的假设是正确的,当链接时,"链接器将检查函数名称而不是参数"在没有使用头文件的情况下?
关于头文件的使用,我遇到了这个链接,它说,我们可以使用#include包含C文件本身.所以,我在newmain.c文件中使用了以下行
#include "some_function.c"
Run Code Online (Sandbox Code Playgroud)
正如所料,它显示了以下错误
错误:函数'function_1()'
错误的参数太少:函数'function_1(1)'的参数太少
而且,我得到了以下(意外)错误:
some_function.c:8:`function_1'some_function.c:8的多重定义
:首先在这里定义
问题2:包含'c'文件本身时我做了什么错误,因为它给出了上述(意外)错误?