Thread: Simple File IO with CStrings....

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    44

    Simple File IO with CStrings....

    Hiya,

    Just as the topic says, how do I output a CString to a file? Currently I'm using:

    ofstream FileOut("me.txt");

    for(i=0;i<ArrS.size();i++){
    FileOut << ArrS.at(i) << "\n";
    }

    As its a CStringArray that I'm using for all of the CString values...

    tyvm
    Uni

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    44
    Ah got it sorted...just add:

    (LPCTSTR) before the returned value so:

    FileOut << (LPCTSTR)ArrSorted.at(i) << "\n";


    Uni

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. Help on simple file functions
    By enjoyincubus in forum C Programming
    Replies: 20
    Last Post: 12-01-2006, 04:41 AM
  3. File IO with .Net SDK and platform SDK
    By AtomRiot in forum Windows Programming
    Replies: 5
    Last Post: 12-14-2004, 10:18 AM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  5. Simple File Creation Algorithm
    By muffin in forum C Programming
    Replies: 13
    Last Post: 08-24-2001, 03:28 PM