The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Opening a Unix File in Windows. a439511 UNIX for Dummies Questions & Answers 6 03-07-2008 05:13 AM
Opening a TCPIP Port with UNIX C DaveBarber High Level Programming 3 04-16-2007 07:55 AM
How do I choose the application when opening a file in UNIX? Mpeter OS X (Apple) 2 10-27-2006 05:48 AM
Opening an Excel File in Unix bubeshj UNIX for Advanced & Expert Users 5 08-03-2006 08:03 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-15-2002
skannan skannan is offline
Registered User
  
 

Join Date: Jun 2002
Location: India
Posts: 3
Unhappy File Opening in C++ in Unix Env

Pls someone help me. This piece of code is giving me weird results.

ofstream outfile;
ofstream out;

char filename1[72];
char filename2[72];


memset(filename1,'\0',sizeof(filename1));
memset(filename2,'\0',sizeof(filename2));

strcpy(filename1,"Testing1.out");
strcpy(filename2,"Testing2.out");

cout << filename1 << filename2;

outfile.open(filename1,ios:ut);
cout << filename1;
out.open(filename2);
cout <, filename2;

The problem here is the first time I print filename1, the value is shown correctly, but after .open, the filename has become null. I get a file create error also. Whereas the filename2 has no problems. I have tried opening filename1 in out and app modes, with binary without binary etc without success.
I have to create the filename1.

Does anybody have any clue as why this is happening?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0