I am trying to work with a file in binary mode. I open the file, read it into a char [8191] buffer (then I look for data in the buffer) and try to loop through the file. My Problem is I hit a EOF or Fail before the end of file. Is there any known bug with binary file access using fstream?
Am I better off using the old C methods?
Thanks
Kelly Burton
Creator@darkhalf.com
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if you are using fstream yeah i would probably use standard c notation as you have access to fscanf() for this so you can use this piece of basic framwork
I am trying to work with a file in binary mode. I open the file, read it into a char [8191] buffer (then I look for data in the buffer) and try to loop through the file. My Problem is I hit a EOF or Fail before the end of file. Is there any known bug with binary file access using fstream?
Am I better off using the old C methods?
Thanks
Kelly Burton
Creator@darkhalf.com
I've had a lot more luck with C notation myself. Sorry, I know that is a completely useless statement for solving your problem.
Wayne
if you are using fstream yeah i would probably use standard c notation as you have access to fscanf() for this so you can use this piece of basic framwork
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
FILE *fp;
char ch;
char line;
if ((fp = fopen("File.txt","r")) == NULL) {
cout<<"error"<<endl; }
while (ch != feof(fp)) {
fscanf(fp,"[8190] %s", line);
cout << line <<endl;
}
}
Ie this should work only framework i havent complied this and dont if it will work and you can build on this i dont think