Results 1 to 3 of 3

Thread: fread's will NOT WORK no matter what

  1. #1

    fread's will NOT WORK no matter what

    All I want to do is open text file 'tstfile.txt' in the subdirectory 'data'.


    that simple.

    I want to read the first string of text out of there, which is:


    but no matter where I tell to get tstfile.txt from, it won't open it and it will give me 'no file found' message.


    fstream file; "data\tstfile.txt", ios::in/ios::nocreate );

    if ( !file )
    MessageBox( NULL, "No File", "INFO", NULL );
    return 0;

    can somebody compile this, and run it to make sure it works?

  2. #2
    Member Contributor
    Join Date
    May 2000
    iowa city

    Re: fread's will NOT WORK no matter what

    It worked for me if you change the back slash to a forward slash and also change fstream to ifstream (MVC 6.0)

    You of course could use

    FILE file=fopen("data/tstfile.txt", "rb");

    [This message has been edited by frogger (edited 06-23-2000).]

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Feb 2000

    Re: fread's will NOT WORK no matter what

    A common error...

    \ means a special character is comming. \n=new line, \t=tab, \a=alarm(a beep)and so on.

    If you want a backslash, you have to type \\.

Similar Threads

  1. PTX file to work with clCreateProgramWithBinary
    By luizdrumond in forum OpenCL
    Replies: 0
    Last Post: 02-06-2012, 03:44 PM
  2. ,exe file does not work on other computer
    By JCheng in forum OpenGL: Windows
    Replies: 8
    Last Post: 04-14-2010, 07:40 AM
  3. Can GLaux file work with Dev-C++??
    By 3rdElement *a* in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-10-2004, 04:42 AM
  4. to work or to gl for games
    By whild_cherry in forum OpenGL: User Software
    Replies: 2
    Last Post: 06-10-2003, 08:58 AM
  5. Y does open gl not work w/ windows xp?
    By Compute Illiterate in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-28-2002, 10:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean