Results 1 to 7 of 7

Thread: Question?

  1. #1
    Nouman Rasheed's Avatar
    Nouman Rasheed is offline Junior Member
    Last Online
    28th February 2010 @ 04:28 PM
    Join Date
    04 Sep 2009
    Location
    Islamabad
    Age
    32
    Posts
    28
    Threads
    4
    Credits
    0
    Thanked
    0

    Default Question?

    Can Any one tell me that how can we write to multiple files in C or C++, each having different names!
    Eg. If I want to create 3 text files in One program?
    each having name:
    Text1.txt
    Text2.txt
    Text3.txt
    How can I use the FILE or Some other function?

  2. #2
    loinheart's Avatar
    loinheart is offline Senior Member+
    Last Online
    17th July 2010 @ 12:53 PM
    Join Date
    10 Jul 2009
    Age
    34
    Posts
    58
    Threads
    6
    Credits
    945
    Thanked: 1

    Default

    simple fstream header ki file use kao aur hr write karne ka liye ofstream ka aik object baneo jaise k main ne program main outfile ka object banaya hai aur us k braces main file save karne ki location batye hai main ne simple ohr us k baad outfile main jo print karwana hai us ko likh do
    thanx

    #include<constream.h>
    #include<fstream.h>
    void main(){
    clrscr();
    cout<<"this is the IT DUNYA of C++ thread ";
    ofstream outfile("itdunya.txt");
    outfile<<"this is the program of c++";
    getch();
    }

  3. #3
    Nouman Rasheed's Avatar
    Nouman Rasheed is offline Junior Member
    Last Online
    28th February 2010 @ 04:28 PM
    Join Date
    04 Sep 2009
    Location
    Islamabad
    Age
    32
    Posts
    28
    Threads
    4
    Credits
    0
    Thanked
    0

    Default

    Thanx Bro! now can u tell me that:
    may nay file ka name user say laina hay aur file ka name aur location usersay laina hay to....?

  4. #4
    mhashmat1967 is offline Advance Member
    Last Online
    11th April 2023 @ 11:50 AM
    Join Date
    27 Jul 2009
    Age
    56
    Posts
    2,049
    Threads
    26
    Credits
    3,520
    Thanked
    70

    Default

    Sorry....

  5. #5
    Ghalib Awan's Avatar
    Ghalib Awan is offline Advance Member
    Last Online
    14th February 2022 @ 02:55 AM
    Join Date
    01 Feb 2010
    Location
    Hong Kong
    Age
    35
    Gender
    Male
    Posts
    6,672
    Threads
    187
    Credits
    86
    Thanked
    789

    Default

    aik string mein user sy file ka complete naam ly lain jaisy k
    c:\files\t2.txt
    .
    Aur phir "outfile()" mein us string ka naam dy dain without quotes, you are done;

  6. #6
    Faiza1947 is offline Junior Member
    Last Online
    26th June 2010 @ 03:51 PM
    Join Date
    08 Jun 2010
    Posts
    2
    Threads
    0
    Credits
    935
    Thanked
    0

    Default

    can u tell me classes me "new" function kesay use kertay hai?????

  7. #7
    Ganxtr's Avatar
    Ganxtr is offline Advance Member
    Last Online
    5th July 2019 @ 09:15 AM
    Join Date
    15 Nov 2009
    Location
    CRIME CITY
    Posts
    1,740
    Threads
    18
    Credits
    83
    Thanked
    100

    Default

    :-/

Similar Threads

  1. Solved Q21. ITD Winner Rank Question (Final Question)
    By Afridi in forum ITDunya 18th Anniversary (8 Nov 2023)
    Replies: 9
    Last Post: 8th November 2011, 10:09 PM
  2. Solved c++ question
    By shamsgul in forum Solved Problems (IT)
    Replies: 17
    Last Post: 11th July 2011, 01:17 AM
  3. new game question with question..........
    By lucky shah in forum Baat cheet
    Replies: 12
    Last Post: 16th July 2010, 02:53 AM
  4. a little question
    By esr in forum Ask an Expert
    Replies: 8
    Last Post: 10th October 2008, 12:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •