fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <cctype>
  4. #include <sstream>
  5. using namespace std;
  6.  
  7. int main(){
  8.  
  9. //strcpy - String copy, strcat= string concatenantion?, strlen.
  10.  
  11. //char chArray[80];
  12. //char chArray2[80];
  13.  
  14. //cin >> chArray; // Doesn't handle white space.
  15. //getline(cin, varname)-- not suitable for character arrays. Be careful with these.
  16. //cout << "Enter your first name: ";
  17. // cin >> chArray;
  18.  
  19. //cout << "\nEnter your last name: ";
  20. //cin >> chArray2;
  21. //cin.getline(chArray, 79);//Last character needs to be a '\0'--Null zero.
  22. /*
  23.   int i;
  24.   for(i=0; chArray[i]!='\0'; i++){// |D|A|M|I|E|N|\0| | | | | | | | | | | | | | | |
  25.   chArray2[i]=chArray[i];
  26.   }
  27.   chArray2[i] = '\0';
  28.   */
  29. //strcpy(chArray2, chArray);
  30.  
  31. /*
  32.   int size1 = strlen(chArray);
  33.   int size2 = strlen(chArray2);
  34.  
  35.   strcat(chArray, chArray2);// -- proper way to strcat
  36.  
  37.  
  38.   cout <<"Your name is: "<<chArray << endl <<"Which is: " << size1+size2 << " Letters in length";
  39.   **/
  40.  
  41.  
  42.  
  43. char fileName[256];
  44. char fileDir[256];
  45. char file[512];
  46.  
  47. cout << "Enter the filename that you want to use: ";
  48. cin >> fileName;
  49.  
  50. cout <<"\nEnter the file's directory: ";
  51. cin >> fileDir;
  52.  
  53. strcat(fileDir, fileName);
  54. strcpy(file, fileDir);
  55.  
  56. cout<<file;
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. return 0;
  67. }
  68.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
system.txt
c:\windows\
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:53: error: ‘strcat’ was not declared in this scope
prog.cpp:54: error: ‘strcpy’ was not declared in this scope
stdout

Standard output is empty