Thread: why is the flag being set to fail

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    71

    why is the flag being set to fail

    after the second input it seems like the fail flag is set and it wont accept input the next time

    here is the code.. really small and simple program

    Code:
    #include <iostream>
    #include <conio.h>
    #include <cstring>
    using namespace std;
    
    int main (void)
    {
    	int x = 0;
    	char *f1,*f2,*f3;
    	char f1f[20],f2f[100];
    	cout << "Enter the number of loops: ";
    	cin >> x;
    	cout << "Enter the Computer Name: ";
    	cin >> f1f;
    	cout << "Type in the message you wanna send: ";	
    	cin.getline (f2f, sizeof (f2f),'\n');
    	f1 = new char [strlen(f1f)+1];
    	strcpy (f1, f1f);
    	f2 = new char [strlen(f2f)+1];
    	strcpy (f2, f2f);
    	f3 = new char [11+strlen(f1)+strlen(f2)];
    	strcpy (f3, "net send ");
    	strcat (f3, f1);
    	strcat (f3, " ");
    	strcat (f3, f2);
    	for (int i = 0; i < x; i++)
    		system (f3);
    	return 0;
    }
    cheers
    Last edited by mackol; 04-17-2003 at 05:36 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. The new FAQ
    By Hammer in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 08-30-2006, 10:05 AM
  2. C help for network animator
    By fastshadow in forum Tech Board
    Replies: 7
    Last Post: 03-17-2006, 03:44 AM
  3. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. Set fail flag in istream
    By *ClownPimp* in forum C++ Programming
    Replies: 0
    Last Post: 03-20-2003, 09:24 PM