C Help - Open and Read a File

Soldato
Joined
27 Aug 2004
Posts
17,111
Location
Geordieland
Hi guys, could do with a hand here if possible.

Basically, I have a file called for example hello.txt, I simply want to read the contents of the file and store them into a declared variable. Probably a simple solution, but spent all day screaming at it.

Can anyone at least chuck me a hint as to what Im doing please.

Cheers
Stellios
 
Ah right, we werent far off then, just trying to do it in the wrong order.

Cheers guys, much appreciated. Cant believe we have spent the majority of the afternoon trying to write half a dozen lines of text.
 
I expect you learnt a lot in the afternoon though so its all good :) Let us know if you need any more help.

Quite a lot yeah, especially considering Im terrible at programming :)

Basically its a small part of a program, we have to create a server and client system for a bus stop so that bus information can be transmitted from a control centre to a bus stop display.

1. Initialise connection between server and client
2. Client passes its client ID to server
3. Server reads corresponding IDs file to pull information, formats it correctly and passes it back to client
4. Client displays information on screen

Its proving a right pig. but we are getting there :)

Once thats done, then for the fun one, program a game of pong in assembly language :(
 
Back
Top Bottom