Assign NULL to stream objects


 
Thread Tools Search this Thread
Top Forums Programming Assign NULL to stream objects
# 1  
Old 12-10-2009
Question Assign NULL to stream objects

Hi,
I am trying to initialize fstream objects to NULL but its throwing an error.Could somebody tell me better way to do this.
I have code in C++ & compiling it using g++ compiler on a Linux box.


Code:
 
ifstream file;
file=NULL;

error

Code:
 
omega.cpp:38: error: no match for 'operator=' in '((OMEGA*)this)->OMEGA::file = 0'
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/iosfwd:90: note: candidates are: std::basic_ifstream<char, std::char_traits<char> >& std::basic_ifstream<char, std::char_traits<char> >::operator=(const std::basic_ifstream<char, std::char_traits<char> >&)

# 2  
Old 12-10-2009
That operation does not even make sense. What are you trying to do -- what is the goal here?
# 3  
Old 12-10-2009
I think you may want an ifstream pointer, not an ifstream object. The pointer can be set to NULL, the object itself can not.
# 4  
Old 12-11-2009
Question

The puprose I am doing that is assign a NULL value to the object & check this object against NULL value in the next operations like while opening & checking errors in opening.

Could anybody tell me better way to do this?
# 5  
Old 12-12-2009
What does 'assign a null value to the object' even mean? The concept continues to make no sense. It doesn't "become null" either. You need to learn the basics.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If grep value is null then assign 0 to variable

DELETE=`cat $logfile1 | egrep -i "Delete" | sed 's/ */ /g' | cut -d" " -f2` INSERT=`cat $logfile1 | egrep -i "Insert" | sed 's/ */ /g' | cut -d" " -f2` UPDATE=`cat $logfile1 | egrep -i "Update" | sed 's/ */ /g' | cut -d" " -f2` I need soming like below: if value is null... (8 Replies)
Discussion started by: Veera_V
8 Replies

2. UNIX for Dummies Questions & Answers

/dev/null 2>&1 Versus /dev/null 2>1

How are these two different? They both prevent output and error from being displayed. I don't see the use of the "&" echo "hello" > /dev/null 2>&1 echo "hello" > /dev/null 2>1 (3 Replies)
Discussion started by: glev2005
3 Replies

3. Shell Programming and Scripting

Insert string 'NULL' where there is a null value

I have an input file having 7 fields delimited by , eg : 1,ABC,hg,1,2,34,3 2,hj,YU,2,3,4, 3,JU,kl,4,5,7, 4,JK,KJ,3,56,4,5 The seventh field here in some lines is empty, whereas the other lines there is a value. How do I insert string NULL at this location (7th loc) for these lines where... (8 Replies)
Discussion started by: zilch
8 Replies

4. Shell Programming and Scripting

[Video stream] network stream recording with mplayer

Hi I used this command: mplayer http://host/axis-cgi/mjpg/video.cgi -user root -passwd root \ -cache 1024 -fps 25.0 -nosound -vc ffh264 \ -demuxer 3 -dumpstream -dumpfile output.avi It's ok but... Video Playing is very fast! Why? Is it a synch problem? What parameter I have to use for... (1 Reply)
Discussion started by: takeo.kikuta
1 Replies

5. Programming

Error in handling stream objects

Hi, I am trying to write a C++ code to write a file with the similar data between two input files.Input files will be command line arguments.Following is the code ,I am able to open & create files but getting errors during comparison & there is no explicit error message I am getting please let me... (1 Reply)
Discussion started by: forstudy3
1 Replies

6. Shell Programming and Scripting

compare null with non-null

I've got a very peculiar situation. I'm trying to find out if we can compare null fields with non-null. I've output csv files from SQL and Oracle. I need to compare each field from the files, and then find out any differences. The files usualy have over 500 fields, and send the resule to DBA.... (8 Replies)
Discussion started by: nitin
8 Replies

7. UNIX for Advanced & Expert Users

debugging shared objects

Hi, i am trying to debug a binary which is using a shared lib. but i could not succeed in tracking the code flow in the classes defined in this library. i get: class MyClass <opaque> error i followed the instructions in the link below:... (0 Replies)
Discussion started by: yakari
0 Replies

8. UNIX for Advanced & Expert Users

Business Objects on Solaris

Has anyone installed BO on a Solaris 8 server that accesses DB2? I am having a problem the I am filling a file system up but the available precentage remains the same. (1 Reply)
Discussion started by: EdZ
1 Replies

9. UNIX for Advanced & Expert Users

Shared Objects

Hi. Does anyone know by how much a text size of an executable(on ibm) would grow if you link one shared object(library)? Is it a constant number or it depends on a .so that is linked? (3 Replies)
Discussion started by: Yura
3 Replies

10. UNIX for Dummies Questions & Answers

Shared Objects

Hi Friends ! I have a library, say libxyz.a. To view all the object files in the archive, i issued the command : ar -t libxyz.a which displayed all the object files it contains. Now, I would like to know the functions in each object file. Is there any such command that displays... (3 Replies)
Discussion started by: mrgubbala
3 Replies
Login or Register to Ask a Question