Simple File IO with CStrings....

This is a discussion on Simple File IO with CStrings.... within the C++ Programming forums, part of the General Programming Boards category; Hiya, Just as the topic says, how do I output a CString to a file? Currently I'm using: ofstream FileOut("me.txt"); ...

  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-22-2008, 12:19 AM
  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, 11:51 PM
  5. Simple File Creation Algorithm
    By muffin in forum C Programming
    Replies: 13
    Last Post: 08-24-2001, 04:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21