Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
so i'm learning about indirections, and i'd like to know how i may change the following code to obtain the .txt file from the internet instead of from my desktop.

PHP:
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
	{
	
	FILE *textFile = fopen ("/Users/me/Desktop/textFile.txt", "r");
	char word[100];
	
	while (fgets(word, 100, textFile))
		{
		word[strlen(word) - 1] = '\0';
		NSLog (@"%s is %d characters long", word, strlen(word));
		}
		
	fclose (textFile);
	return (0);
	}

simply changing the file's address to an http address doesn't work.

any thoughts?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.