C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old May 1st, 2008, 04:47 AM
Lass Lass is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 1 Lass User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 50 sec
Reputation Power: 0
My emergency room

hey every body,
in my project-Emergency room Simulator- i should open file for all patient if he didnt have one, so, when the patient come,
i will ask him if he has a file, if yes, i will read his information and add some more in it, if not
i will open new file for him, i'll receve the patient as node of Queue, then i will write his information in a file.
this is my Code, and as u see there r problem with the concatenation of these strings then put it between quotationMark


Code:
void  read_patient_file(Patient &patient,string fn)
{

    string extention=".txt";
    string file_num;
    for (int d=0;d< fn.length();d++)
    file_num[d]=fn[d];
    string loction="C:\\";

    string file_name=loction+file_num+extention;

	ifstream infile;
	infile.open("file_name", ios::in);

    if(!infile)
      {
      	cout<<"file could not open";
        exit(1);
      }

         infile>>patient.name>>patient.age>>patient.gender>>patient.fileNumber>>patient.illness>>patient.degree;
         infile.close();
}


Code:
void patient_file(Patient patient)
{

    string file_num,extention,loction,file_name;

    extention=".txt";
    file_num=patient.fileNumber;
    loction="C:\\pateint";

    file_name=loction+file_num+extention;

    ofstream ofile ("file_name", ios::out);
    if(!ofile)
     {
    	cout<<"Can't open output file";
        exit(1);
     }

        ofile<<patient.name<<'  '<<patient.age<< '  '<<patient.gender<< '  '<<patient.fileNumber<< '  '<<patient.illness<< '  '<<patient.degree;
        ofile.close();
}



how could i solve this problem,
and if i want to gather all patient file in One fail (patient record) how could i do it?

Code:
void patient_record()//record of all patient
{
    ofstream ofile ("C:\\pateint.txt", ios::out);
    if(!ofile)
     {
    	cout<<"file could not open";
        exit(1);
     }
        ofile.close();
}



hope u can help me sooon
thank u

Reply With Quote
  #2  
Old May 6th, 2008, 07:03 AM
MaHuJa MaHuJa is offline
Contributing User
Click here for more information.
 
Join Date: Dec 2007
Posts: 338 MaHuJa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 14 h 13 m 10 sec
Reputation Power: 1
Send a message via Skype to MaHuJa Send a message via XFire to MaHuJa
Quote:
for (int d=0;d< fn.length();d++)
file_num[d]=fn[d];


What's wrong with
file_num=fn;
?

Copying a standard string byte for byte is missing the whole point of using a string.

And putting file_name in quotation marks anywhere makes it not refer to the variable.

Quote:
to gather all patient file in One fail

We wouldn't happen to have a quote of the month award on these boards, do we?


If you want to make that last file a combination of all the other files, then you will have to look up all those files, open them, and process/copy their contents, outputting it into the output file.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > My emergency room


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway