|
-
Dec 8th, 2000, 02:11 PM
#1
Thread Starter
Frenzied Member
How do i read a line from a text file in a Win32 app. If i use this in a non dos app i get errors:
Code:
char buffer[81];
FILE *in_file,*fopen();
char *fgets();
if((in_file = fopen ( "c:\\bootlog.txt","r"))!= NULL )
{
fgets(buffer,81,in_file);
}
Errors:
: error C2660: 'fopen' : function does not take 2 parameters
: error C2660: 'fgets' : function does not take 3 parameters
-
Dec 8th, 2000, 02:38 PM
#2
Thread Starter
Frenzied Member
I managed to get this to work
Code:
#include <fstream>
#include <string>
using namespace std;
string str;
ifstream i("c:\\bootlog.txt");
getline(i,str);
-
Dec 8th, 2000, 09:30 PM
#3
Frenzied Member
Why declare fopen() and fgets()? They're both in stdio.h, so why declare them with a different parameter list? I think if you leave the function declarations out the first bit of code should work.
Harry.
"From one thing, know ten thousand things."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|