Thread: can fout write on a *.bat file?

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    117

    can fout write on a *.bat file?

    if no, can c++ change one file's extention from *.txt to *.bat??

  2. #2
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    The file can be named whatever you like.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    117

    what do you mean??

    do you mean that i can use the command:


    Code:
    ofstream fout("testing.bat")
    instead of

    Code:
    ofstream fout("testing.txt")
    ??

  4. #4
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    Yeah, but why don't you just try it instead of asking?

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    117

    i am sorry cos...........

    i have tried that indeed but i am using visual C++.net in my office, i dun know why it do not support <iostream.h>....i will try that at home with c++ 6.0

    thank you for your help anyway

  6. #6
    Registered User foniks munkee's Avatar
    Join Date
    Nov 2001
    Posts
    343
    i dun know why it do not support <iostream.h>
    Because it should be <iostream> - no .h - that is the old, depricated style.

    i.e.
    Code:
    #include <iostream>
    
    int main(void)
    {
        std::cout << "this way is more correct" << std::endl;
        return 0;
    }
    You should really be doing it this way in VC++ 6.0 anyway, as it supports this method of including the iostream header, as per the standard.
    "Queen and huntress, chaste and fair,
    Now the sun is laid to sleep,
    Seated in thy silver chair,
    State in wonted manner keep."

  7. #7
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    or the smarter method...
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main(void)
    {
        cout << "bling!¿" << endl;
        return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. File Writing Problem
    By polskash in forum C Programming
    Replies: 3
    Last Post: 02-13-2009, 10:47 AM
  3. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  4. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM