我在声明字符串变量时遇到了一些麻烦.代码和错误在这里:http://pastebin.com/TEQCxpZd任何关于我做错了什么的想法?另外,请保持平台独立.谢谢!
#include <stdio.h>
#include <string>
using namespace std;
int main()
{
string input; //Declare variable holding a string
input = scanf; //Get input and assign it to variable
printf(input); //Print text
return 0;
}
Getting this from GCC:
main.cpp: In function ‘int main()’:
main.cpp:53:10: error: invalid conversion from ‘int (*)(const char*, ...)’ to ‘char’
main.cpp:53:10: error: initializing argument 1 of ‘std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>, …
Run Code Online (Sandbox Code Playgroud) 我正在寻找类似于windows.h中Win32API调用的编写和读取进程内存的函数,但我似乎无法找到任何标准C++,我希望它与平台无关.