Thursday, July 30, 2009

Using file IO in c programming?

I have coded a c program to display all palindrome words from a text file...however I can't get my program to read the data from the text file "words.txt" anyone know how to tell my program to look in a specific location


fp=fopen("c:\\words.txt", "r");





the file is on my desktop and when i right click on it the location is C:\Documents and Settings\VICTOR\Desktop

Using file IO in c programming?
well on my mac i do this


fp=fopen("words", "r");


and it works take in mine its on my desktop.


after every folder put a /


i think maybe putting cd some and document then desktop should work. try it and see
Reply:put it in the same directory as the source file
Reply:if you leave on your desktop:


fp=fopen("C:\\Documents and Settings\\VICTOR\\


Desktop\\words.txt", "r");





if you place in the same folder as the "exe" file:


fp=fopen("words.txt", "r");


No comments:

Post a Comment