Hello everybody:
i'm a new member in this site and i realy have a problem with c++.
ok my problem is :
i want to read text from a file and the text contains characters and decimal and hexadecimal using fscanf but when i debug (run the program) i only get smiley faces...??? but when i used getc() it worked ok!!! but the homework is with using fscanf()??????
this my program and i hope someone responds very fast i'm running out of time???
[CODE=cpp]#include <stdio.h>
#include <iostream.h>
#include <conio.h>
main()
{
FILE *fptr;
fptr=fopen("c:\ \Lab4.txt","r") ;
if (!fptr) cout<<"error openning file\n";
char ch;
while (!feof(fptr))
{
ch=fscanf(fptr, "%c",&ch);
cout<<ch;
}
fclose(fptr);
getch();
}[/CODE]
please help>>>
i'm a new member in this site and i realy have a problem with c++.
ok my problem is :
i want to read text from a file and the text contains characters and decimal and hexadecimal using fscanf but when i debug (run the program) i only get smiley faces...??? but when i used getc() it worked ok!!! but the homework is with using fscanf()??????
this my program and i hope someone responds very fast i'm running out of time???
[CODE=cpp]#include <stdio.h>
#include <iostream.h>
#include <conio.h>
main()
{
FILE *fptr;
fptr=fopen("c:\ \Lab4.txt","r") ;
if (!fptr) cout<<"error openning file\n";
char ch;
while (!feof(fptr))
{
ch=fscanf(fptr, "%c",&ch);
cout<<ch;
}
fclose(fptr);
getch();
}[/CODE]
please help>>>
Comment