Gnutella Forums  

Go Back   Gnutella Forums > Gnutella News and Gnutelliums Forums > General Gnutella Development Discussion
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Today's Posts

General Gnutella Development Discussion For general discussion about Gnutella development.


 
 
LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old November 22nd, 2007
Novicius
 
Join Date: November 18th, 2007
Posts: 4
helpfred is flying high
Default store information from txt file in array

Hi,

So i have been trying to simulate a gnutella network with query and queryhit, this is what i have so far.

I have a txt file containing these information:

1,781,573,948
2,872,779,332
3,361,502,328
.
.
.
.
999,725,446,280
1000,848,451,759
so basically 1000 lines (it represent nodes, with 3 nighbours)
I need to read this txt file and store this file in an array, also i have another txt file conatins information like this:
1,6
2
3,1
.
.
.
999,5
1000,7
so again nodes but this time with resources so 1000 is a node and 7 is a resource.
basically what i have to do is, query say node 1 to see if it has a resource of 6 in this case it has so ignore this one, so say query to node 2, as it dosent have resource 6 so now to look at its neighbours this information is then looking at the first file to see its neighburs:
I am trying to similate a gnutella network with just query and queryhit with ttl3 and ttl4. so here is the code i have so far.
Code:
  #include <iostream>  
  #include <fstream>
  #include <cstdlib>
  using namespace std; 
int main ()
{
 
ifstream inputFile;
inputFile.open("Network.txt");
if (!inputFile)
{
cout << "Error opening file!" << endl;
exit(1);
}
int data[1000]; // this line is Appended
int node;
int i=0;
////////// here is the code in which to put the elements of the file into the data array.
while (!inputFile.eof())
{  // keep reading until end-of-file
  inputFile >> node;
  data[i++] = node;
}
 
  inputFile.close();
  return 0;
}

As this is my first programming task i have no idea whether i am doing this right.
If anyone can tell if i am on the right direction that would be great, or if you could point me to the right direction.
Thank you.
Reply With Quote
 


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 12:00 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.