473,387 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

graph issue

momotaro
357 100+
Expand|Select|Wrap|Line Numbers
  1.  node *BuildGraph() 
  2.  
  3. {
  4.  
  5. int range, vehicules, i, j, k;
  6.  
  7. char ch;
  8.  
  9. vehicule *V = NULL,
  10.  
  11. *E = NULL;
  12.  
  13. node *N = NULL;
  14.  
  15. //edge *NewEdge;
  16.  
  17. FILE *InputFile = fopen("data.txt", "r");
  18.  
  19. if(!InputFile)
  20.  
  21. ERROR("FILE COULD NOT BE OPENED");
  22.  
  23. else
  24.  
  25. {
  26.  
  27. fscanf(InputFile, "%d %d", &vehicules, &range);
  28.  
  29. for(i = 0; i < vehicules; i++)
  30.  
  31. {
  32.  
  33. fscanf(InputFile, "%d %d", &vehicules, &range);
  34.  
  35. for(k = 0; k < i; k++)
  36.  
  37. for(ch = getc(InputFile); ch != '\n'; ch = getc(InputFile))
  38.  
  39. V = CreatVehicule();
  40.  
  41. fscanf(InputFile, "%s %d %d", V->CarId, &V->x, &V->y);
  42.  
  43. N = InsertVehicule(N, V);
  44.  
  45. for(j = 0; j < vehicules; j++)
  46.  
  47. {
  48.  
  49. fseek(InputFile, 0, 0);
  50.  
  51. fscanf(InputFile, "%d %d", &vehicules, &range);
  52.  
  53. E = CreatVehicule();
  54.  
  55. fscanf(InputFile, "%s %d %d", E->CarId, E->x, E->y);
  56.  
  57. E->distance = Distance(V->x, V->y, E->x, E->y);
  58.  
  59. if(E->distance <= range)
  60.  
  61. {
  62.  
  63. N = InsertEdge(N, E);
  64.  
  65. }
  66.  
  67. }
  68.  
  69. //break;
  70.  
  71. }
  72.  
  73. }
  74.  
  75. fclose(InputFile);
  76.  
  77. return N;
  78.  
  79. }
  80.  
  81.  
am having those errors:
[size=1]First-chance exception at 0x10295db1 (msvcr90d.dll) : 0xC0000005: Access violation writing location 0x00000000.

Unhandled exception at 0x10295db1 (msvcr90d.dll) : 0xC0000005: Access violation writing location 0x00000000.

[/size]
Nov 24 '07 #1
2 1475
Ganon11
3,652 Expert 2GB
Sounds to me like there is a pointer error going on. Either you are trying to access a pointer that has been freed, or that you are making a pointer point somewhere that hasn't been allocated. Check any part of your program that uses pointers, and make sure you aren't doing things like exceeding the bounds of an array or using it after a free() statement.
Nov 25 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
Have you stepped thgrougfh the code using your debugger???

If not, learn how to use the debugger. You can pinpoint the failure exactly.
Nov 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Lilith | last post by:
Is there a python module somewhere (been searching today, no luck) which has efficiently coded various graph-handling routines, such as finding the shortest path through a graph, or the set of all...
25
by: Magnus Lie Hetland | last post by:
Is there any interest in a (hypothetical) standard graph API (with 'graph' meaning a network, consisting of nodes and edges)? Yes, we have the standard ways of implementing graphs through (e.g.)...
1
by: JD Kronicz | last post by:
Hi .. I have an issue I have been beating my head against the wall on for some time. I am trying to use late binding for MS graph so that my end users don't have to worry about having the right...
0
by: Arno R | last post by:
Hi there, I have a MsGraph-chart in my report. I just want to display a graph for each record (just plain bars for a value each year, nothing fancy) On one PC where only Access 97 is installed...
2
by: borekfm | last post by:
Hitting two problems when running a new report I've created, that contains a chart/graph. The chart shows three series, two are shown as lines and one as an area. The data come from three different...
8
by: Jef Driesen | last post by:
I'm working on an image segmentation algorithm. An essential part of the algorithm is a graph to keep track of the connectivity between regions. At the moment I have a working implementation, but...
0
by: kaosyeti via AccessMonster.com | last post by:
i have a query that opens up into a very nice 3D bar graph with each verticle bar ranging between 400 - 850 in value. the issue i have is that if you're looking at the graph, the closest major...
8
by: Adrian | last post by:
Having plotted a graph from x,y co-ordinate to x,y co-ordinate, the graph disappears immediately (after the last plot). Writing " " to a label, in between subsequent plots, solves this problem....
4
by: Man4ish | last post by:
namespace ve/////////////////ve.h { struct VertexProperties { std::size_t index; boost::default_color_type color; }; }...
2
by: Man4ish | last post by:
I have created Graph object without vertex and edge property.It is working fine. #include <boost/config.hpp> #include <iostream> #include <vector> #include <string> #include...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.