- c ++ string declaration: one is the array of characters and the assignment statement, the other is a direct statement string class
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<string> #include "mycoach.h" using namespace std; void main() { char *name = (char*)malloc(sizeof(char)); strcpy (name, " Chen Peichang " ); String NAME2 = " Fugao Feng " ; cout << name << endl; cout << name2 << endl; system("pause"); }
- C language file directory traversal way ---- this coup autobiography Chi podcast lecturer Yin Cheng C language, C language if you go look at the official documentation or online article, a general introduction to the C language through the file directory, its complexity complicated you can not help but question whether firing from integrated circuit board to learn, and Yoon Sung provides a wonderful way you can a big somersault, the use of CMD command. The result prints to memory, and then redirected to a text file, ask you Fubu Fu, anyway, I think the family portrait hanging Yoon Sung
C实现 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> void main() { char cmd [ 300 ]; char path [ 180 [ ] = " F.:. 5 \\ _ Wan Shing Chi Chuan podcast from novice to expert language _C _ _ Chapter C language function pointer array _ _ _ string union structure " ; sprintf(cmd, "dir \"%s\" /b /s>F:\\tianheiwadi.txt", path); system(cmd); system("pause"); }
In C ++ can be used so
#include < String > #include " mycoach.h " the using namespace STD; void main () { char cmd [ 200 is ]; char path [ 80 ] = " F.: \\ basis of Chapter .C ++ " ; sprintf(cmd, "dir \"%s\" /b /s>F:\\wenheichouwa.txt", path); system(cmd); system("pause"); }