Like Tree1Likes
  • 1 Post By tabstop

nbin=fopen("input.txt","a"); doesn't work?

This is a discussion on nbin=fopen("input.txt","a"); doesn't work? within the C Programming forums, part of the General Programming Boards category; Code: nbin=fopen("input.txt","a"); I thought this would open input.txt and then, for example: Code: fprintf(nbin,"a"); would append "a" to input.txt However ...

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    78

    nbin=fopen("input.txt","a"); doesn't work?

    Code:
    nbin=fopen("input.txt","a");
    I thought this would open input.txt and then, for example:

    Code:
    fprintf(nbin,"a");
    would append "a" to input.txt

    However I get the error:
    Code:
    `nbin' undeclared
    How do I properly declare it? This worked fine in VisualC++ but now I'm trying to get my program to compile on Linux so its a bit different I guess.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I have no idea how you could have made it work in Visual C++ without
    Code:
    FILE *nbin;
    somewhere.
    stahta01 likes this.

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    78
    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. "Segment Violation" error, fopen("r+")
    By jiboso in forum C Programming
    Replies: 1
    Last Post: 03-10-2011, 09:57 AM
  2. Replies: 4
    Last Post: 08-12-2009, 04:03 PM
  3. [Segmentation Fault] fopen("filename","w")
    By gibbofresco in forum C Programming
    Replies: 7
    Last Post: 07-04-2009, 05:32 AM
  4. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  5. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21