小编Mik*_*ike的帖子

C++字符串变量声明

我在声明字符串变量时遇到了一些麻烦.代码和错误在这里: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)

c++ string variables declaration

7
推荐指数
1
解决办法
5万
查看次数

记忆编辑功能

我正在寻找类似于windows.h中Win32API调用的编写和读取进程内存的函数,但我似乎无法找到任何标准C++,我希望它与平台无关.

c++ memory standards editing

1
推荐指数
1
解决办法
340
查看次数

标签 统计

c++ ×2

declaration ×1

editing ×1

memory ×1

standards ×1

string ×1

variables ×1