Thread: string problems

  1. #16
    Covenent Killer
    Join Date
    Jul 2005
    Posts
    26
    ok... i never thought about that! im new to FTP so im learning a little at a time... I found ways to do FTP in VC++ and C#, but couldn't find anything for C++ on MSDN
    When I joined the Core, We didnt have any fancy Shmancy tanks! We had Sticks, TWO sticks and a rock for a whole platoon, And we had to share the rock! -- Sarge

    My Other Name Is Warhawk
    They Just Didn't let Me Have That Name...

  2. #17
    Covenent Killer
    Join Date
    Jul 2005
    Posts
    26
    while were talking about FTP, if you connect through FTP to astecinc.95mb.com and put in username astecinc.95mb.com, it brings up the password input... when you type stuff, the cursor never moves -- I dont want to do that but I do want to mask the text with asteriks... I can do this in HTML and in JavaScript, but can someone give me pointers? I'm researching right now and if i find something, I'll post for you guys...
    When I joined the Core, We didnt have any fancy Shmancy tanks! We had Sticks, TWO sticks and a rock for a whole platoon, And we had to share the rock! -- Sarge

    My Other Name Is Warhawk
    They Just Didn't let Me Have That Name...

  3. #18
    Covenent Killer
    Join Date
    Jul 2005
    Posts
    26
    nazca -- thanks soooo much, but actually -- you don't need the extension to be .ftp, it needs to be .txt, but thanks for the advise! now back to character masking...

    I made a code using that principle, but i need help on how to get rid of the file -- see the code and i marked the files in red that need to be deleted before the program ends... I know that you use the "ios::trunc" function, but how do i use it?
    Code:
    #include <iostream>
    #include <stdlib.h>
    #include <string>
    #include <windows.h>
    #include <fstream>
    
    using namespace std;
    
    int main()
    {
        system("title Demo Project For cprogramming.com!");
        string info;
        cout << "                   Please Enter Your Name: ";
        cin >> info;
        ofstream a_file ("info_name.txt", ios::app);
        a_file << info;
        a_file << endl;
        a_file.close();
        ofstream b_file ("ftpsend.txt");
        b_file << "o" << endl;
        b_file << "your.FTP.com" << endl;
        b_file << "your.Username" << endl;
        b_file << "your.Password" << endl;
        b_file << "send info_name.txt" << endl;
        b_file << "bye" << endl;
        b_file.close();
        system("ftp -s:ftpsend.txt");
        system("cls");
        cout << "                    Press [Enter] To Exit This Program!" << endl;
        cin.get();
    }
    Do I need to classify another ofstream x_file?
    Last edited by Halo2Master; 08-03-2005 at 05:06 PM. Reason: error
    When I joined the Core, We didnt have any fancy Shmancy tanks! We had Sticks, TWO sticks and a rock for a whole platoon, And we had to share the rock! -- Sarge

    My Other Name Is Warhawk
    They Just Didn't let Me Have That Name...

  4. #19
    He's trying.
    Join Date
    Apr 2005
    Location
    Missouri, US
    Posts
    70
    I'm sure there's a much, much less hacky way to do it but as far as what you're asking goes:
    Code:
    a_file.close();
    b_file.close();
    ofstream clearThis("info_name.txt", ios::trunc);
    ofstream thisToo("ftpsend.txt", ios::trunc);
    
    clearThis << endl;    // not sure if it's necessary but figure it'll make sure everything's cleared
    thisToo << endl;
    
    clearThis.close();
    thisToo.close();
    If you ask me, while you're using system calls you might as well use
    Code:
    system("del info_name.txt");
    system("del ftpsend.txt");
    Which will actually destroy the files instead of emptying them. There's probably an ANSI standard way to do it, too.


    Btw - on my box, files with the ".ftp" extension will work, but those with ".txt" will not. Strange. Maybe I mixed it up?
    Last edited by Nazca; 08-03-2005 at 11:52 PM.

  5. #20
    Covenent Killer
    Join Date
    Jul 2005
    Posts
    26

    Masking Issues

    hmmm... good point. I tried using the first method before i posted the question but it didnt do anything...

    Now back to the masking issue... I found a way to do it through VC++ and VB, and i did find one way to do it through C++ but i cant get it to work anymore... i talked with another guy who said to use a combo of "\b" which is backspace and a find x,y function... basically telling the computer to backspace and replace the character with an asterisk (*) but hold the data using virtual memory, or something like that.

    Can someone clear this up for me?
    Last edited by Halo2Master; 08-04-2005 at 06:21 PM. Reason: bored
    When I joined the Core, We didnt have any fancy Shmancy tanks! We had Sticks, TWO sticks and a rock for a whole platoon, And we had to share the rock! -- Sarge

    My Other Name Is Warhawk
    They Just Didn't let Me Have That Name...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. RicBot
    By John_ in forum C++ Programming
    Replies: 8
    Last Post: 06-13-2006, 06:52 PM
  3. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  4. io stream and string class problems
    By quizteamer in forum C++ Programming
    Replies: 2
    Last Post: 04-25-2005, 12:07 AM
  5. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM