fopen, fclose

This is a discussion on fopen, fclose within the C++ Programming forums, part of the General Programming Boards category; Code: char *my_args[4]; char wintitle[] = "NipponRO.exe"; char ip[16]; FILE *get_ip; get_ip = fopen("C:\Progra~1\Gravity\RO\Data\Image.bmp","r"); if(get_ip == NULL) { return 0; ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    206

    fopen, fclose

    Code:
    	char *my_args[4];
    	char wintitle[] = "NipponRO.exe";
    	char ip[16];
    	FILE *get_ip;
    
    	get_ip = fopen("C:\\Progra~1\\Gravity\\RO\\Data\\Image.bmp","r");
    	if(get_ip == NULL)
    	{
    		return 0;
    	}
    	if(get_ip != NULL)
    	{
    	ifstream fin;
    	ofstream fout;
    	fin>>ip;
    	fclose(get_ip);
    	char args_one[19] = strcpy("-t ", ip);
    Can someone please explain to me why this is telling me that "-t " and ip are pointers? And how to fix it? Thx

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,396
    char *strncpy( char *to, const char *from, size_t count );
    So you're copying ip to "-t ", which doesnt make sense.

    Still, it looks like you're trying to use C file IO with C++ file IO.
    Why not simply stick to C++ file IO?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fclose slow
    By Rmantingh in forum C Programming
    Replies: 4
    Last Post: 04-08-2010, 11:01 AM
  2. help with stat() and fopen()
    By movl0x1 in forum C Programming
    Replies: 6
    Last Post: 07-25-2007, 05:28 AM
  3. fopen and fclose functions
    By anilk in forum C Programming
    Replies: 20
    Last Post: 01-31-2006, 03:31 PM
  4. fopen vs open
    By rotis23 in forum Linux Programming
    Replies: 5
    Last Post: 12-10-2002, 01:30 PM
  5. fclose()
    By GanglyLamb in forum C Programming
    Replies: 4
    Last Post: 11-11-2002, 07:45 AM

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