Error after running graph command in program

This is a discussion on Error after running graph command in program within the C++ Programming forums, part of the General Programming Boards category; Hi, The following is a miniscule program that I wrote on Linux to create a line graph. Code: int main() ...

  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    1

    Angry Error after running graph command in program

    Hi,

    The following is a miniscule program that I wrote on Linux to create a line graph.

    Code:
    int main()
    {
       fstream myfile;
       myfile.open ("abc.txt");
       for  (float PUF = 0; PUF < 2000; PUF = PUF + 10)
       {
           if (PUF != 0)
           {
                float SI = 1000 / (PUF + 1000);
                myfile << PUF << " " << SI << " ";
           }   
       }
       myfile.close();
       system("graph -T X < abc.txt");
       return 0;
    }
    This piece of code works. A seperate window opens up and I can view my graph in that window. But on closing the window, I get the following error.

    XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
    after 735 requests (735 known processed with 0 events remaining.
    If I use float the following message also appears.
    graph: input file terminated prematurely
    Can someone tell me what I am doing wrong out here?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    But that has nothing to do with your C++ program.

    You'd get the same error message just by typing in manually:
    graph -T X < abc.txt

    Maybe it's complaining that there are an odd number of coordinates in the file?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 09-05-2005, 08:57 AM
  2. Running program from windows program?
    By Brian in forum Windows Programming
    Replies: 3
    Last Post: 01-26-2002, 09:19 PM
  3. Running program on background?
    By Couhilin in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2001, 06:50 AM
  4. Why is my program running away?
    By badkitty in forum C++ Programming
    Replies: 4
    Last Post: 09-19-2001, 04:27 PM
  5. Running program
    By muffin in forum C Programming
    Replies: 5
    Last Post: 08-30-2001, 10:57 AM

Tags for this Thread


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