GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Nov-2005, 07:07
i hate c i hate c is offline
New Member
 
Join Date: Nov 2005
Posts: 16
i hate c is on a distinguished road

runtime error R6002


anyone know why i would get a runtime error R6002
- floating point not loaded
in what seems like a fine program
it occurs at the point where the program attempts to read a file
  #2  
Old 22-Nov-2005, 07:32
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: runtime error R6002


Hi Mick,

Please post the simplified code you have, so that we may take a look at it and tell you what is the error.

Here is an extract from MSDN about the error R6002:
Quote:
Originally Posted by MSDN
C Run-Time Error R6002:

floating-point support not loaded
The necessary floating-point library was not linked.
Possible causes
  • The program was compiled or linked with an option, such as /FPi87, that requires a coprocessor, but the program was run on a machine that did not have a coprocessor installed.
  • A format string for a printf or scanf function contained a floating-point format specification and the program did not contain any floating-point values or variables.
  • The compiler minimizes a program's size by loading floating-point support only when necessary. The compiler cannot detect floating-point format specifications in format strings, so it does not load the necessary floating-point routines.
  • Use a floating-point argument to correspond to the floating-point format specification, or perform a floating-point assignment elsewhere in the program. This causes floating-point support to be loaded.
  • In a mixed-language program, a C library was specified before a FORTRAN library when the program was linked. Relink and specify the C library last.
-From MSDN.

Regards,
Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #3  
Old 22-Nov-2005, 08:33
i hate c i hate c is offline
New Member
 
Join Date: Nov 2005
Posts: 16
i hate c is on a distinguished road

Re: runtime error R6002


cheers paramesh, i got it sorted
  #4  
Old 22-Nov-2005, 10:59
i hate c i hate c is offline
New Member
 
Join Date: Nov 2005
Posts: 16
i hate c is on a distinguished road

Re: runtime error R6002


i had a double inside a struct that wasnt being seen by the compiler so i just created a 'dummy' double outside the structure to force the compiler to bring in the rest of sscanf, is this the best way to do this?

it got rid of the error msg anyway but now the program simply skips to the 'end of file found msg' without displaying the values contained in the .dat file.
very strange
  #5  
Old 22-Nov-2005, 16:10
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about

Re: runtime error R6002


Quote:
Originally Posted by i hate c
i had a double inside a struct that wasnt being seen by the compiler so i just created a 'dummy' double outside the structure to force the compiler to bring in the rest of sscanf, is this the best way to do this?

it got rid of the error msg anyway but now the program simply skips to the 'end of file found msg' without displaying the values contained in the .dat file.
very strange

Could you share your code with us, so that we can think about your question ?

Kobi.
__________________
It's actually a one time thing (it just happens alot).
  #6  
Old 22-Nov-2005, 17:15
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: runtime error R6002


Hi Mick,

I have a question:
Did you print the variables?

After considering your previous thread, here is an example:
CPP / C++ / C Code:
...
...
...
        /*code....*/
    else
    if (line_ptr == NULL)
        printf( "End of file found\n");
    }

    /*print the variables here and see what you get..*/

    printf("id x    y\n");
    for( i = 0; i < no_nodes; i++)
    {
        printf("%d %.1lf %.1lf\n", node_array[i].id ,node_array[i].x ,node_array[i].y );
    }
Print after the lecturer's code you already have.

and according to your lecturer's code, it end of file found is printed, it indicates that we have got the values from the file and stored it in the variables node_array[i].

Regards,
Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #7  
Old 23-Nov-2005, 07:30
i hate c i hate c is offline
New Member
 
Join Date: Nov 2005
Posts: 16
i hate c is on a distinguished road

Re: runtime error R6002


Got it working again, i'd deleted a line of program when i started to get the runtime error to see if it was causing the problem, just had to put it back in. ive added a lot to the program, to make it a bit more user friendly and then made it able to write the data to a file aswell. its all working fine now and im currently just looking at converting it to use linked lists so ill let you know how that goes.
heres the program anyway, thanks for all the help paramesh, couldn't have done it without u.
  #8  
Old 23-Nov-2005, 07:31
i hate c i hate c is offline
New Member
 
Join Date: Nov 2005
Posts: 16
i hate c is on a distinguished road

Re: runtime error R6002


CPP / C++ / C Code:
#include <stdio.h>
int main(void)
{
char line[101], filename[101];
char *line_ptr;
double dummy = 9;

struct node
	{
	int id;
	double x, y, stress;
	};

struct node node_array[100];			
int no_nodes = 0, no_values, i;
FILE *input_stream, *output_stream;
fprintf(stdout, "Enter the file name you wish to read from: ");
fscanf(stdin, "%s", filename);
fprintf(stdout, "\nReading %s", filename);
    if ((input_stream = fopen(filename, "r")) != NULL)
			{
			fgets(line, sizeof(line), input_stream);
			while (((line_ptr = fgets(line, sizeof(line), input_stream)) != NULL) &&
			((no_values = sscanf (line, "%d %lf %lf %lf",
							&node_array[no_nodes].id,
							&node_array[no_nodes].x,
							&node_array[no_nodes].y,
							&node_array[no_nodes].stress)) == 4)) no_nodes++;
							fclose(input_stream);

			if ((line_ptr != NULL) && (no_values != 4))
				fprintf(stdout, "Error reading line %s\n", line);
			else
				if (line_ptr == NULL)
				fprintf(stdout, "\nEnd of file found\n\n");
				fprintf(stdout, "%s\n\n", filename);
				fprintf(stdout, "node x y stress\n\n");	        //colomn headers//	

			}
	else
		fprintf(stdout, "\nFile does not exist\n");
		

for( i = 0; i < no_nodes; i++)
    {
	fprintf(stdout, "%d %.1lf %.1lf %.1lf\n",
							node_array[i].id,
							node_array[i].x,
							node_array[i].y,
							node_array[i].stress );
	}


fprintf(stdout, "\nEnter the file name you wish to write to: ");
fscanf(stdin, "%s", filename);

((output_stream = fopen(filename, "w")) != NULL);
fprintf(output_stream, "node x y stress\n");
for( i = 0; i < no_nodes; i++)
		{
		fprintf(output_stream, "%d %.1lf %.1lf %.1lf\n",
							node_array[i].id,
							node_array[i].x,
							node_array[i].y,
							node_array[i].stress );
		}

fclose(input_stream);
fprintf(stdout, "\nData has been written to %s\n\n", filename);
return(0);
}
  #9  
Old 23-Nov-2005, 08:34
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: runtime error R6002


Good job Mick.

But you can still improve your program by replacing
"fprintf(stdout" by printf and
"fscanf(stdin" by "scanf" statements.


Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #10  
Old 23-Nov-2005, 11:17
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,435
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: runtime error R6002


Quote:
Originally Posted by Paramesh
Good job Mick.

But you can still improve your program by replacing
"fprintf(stdout" by printf and
"fscanf(stdin" by "scanf" statements.


Paramesh.

And I repeat: READ THIS and THIS
__________________

Definition: Politics
Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime, compile time... kai85 C Programming Language 2 19-May-2005 22:05
Cannot find a runtime error on a fltk app running on windows Frangar FLTK Forum 2 12-May-2005 11:38
how to increase the font size at runtime banur22 MS Visual C++ / MFC Forum 1 21-Apr-2005 06:37
Free copy of Runtime Revolution crystalattice Open Discussion Forum 0 29-Dec-2004 15:52
Problem with php/mysql script during runtime norok MySQL / PHP Forum 3 25-Jun-2003 05:35

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:36.


vBulletin, Copyright © 2000 - 2014, Jelsoft Enterprises Ltd.