CArchive error using << operator

Hey all, 

I'm running into a problem with using the << or >> 
operators when using cout, cin, or CArchive.

It keeps telling me, in the most recent case:

error C2678: binary '<<' : no operator defined which 
takes a left-hand operand of type 'class CArchive' (or 
there is no acceptable conversion).

The offending line of code tries to write 1 item from a 
vector (*allfile) to the archive (*pArchive) like so...

try {
(*pArchive) << (*fit);
}


I ran into this same error when trying to use cout or cin.

Is this a compiler problem, preprocessor problem, missing 
headers?

I'm using VC++ 6.0 Service Pack 5.

Any help is greatly appreciated...

Thank you one and all for any help you can lend!!
0
blairt (2)
10/20/2003 9:29:38 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
994 Views

Similar Articles

[PageSpeed] 7

What is the type for fit?  Is it a vector (from the STL?)  If so, then 
there are several options.  One, you overload the vector class and add 
the operators so you can output them.  Or, you can output them individually.

But, we will need to know what type fit variable is.

Larry

Tojam wrote:

> Hey all, 
> 
> I'm running into a problem with using the << or >> 
> operators when using cout, cin, or CArchive.
> 
> It keeps telling me, in the most recent case:
> 
> error C2678: binary '<<' : no operator defined which 
> takes a left-hand operand of type 'class CArchive' (or 
> there is no acceptable conversion).
> 
> The offending line of code tries to write 1 item from a 
> vector (*allfile) to the archive (*pArchive) like so...
> 
> try {
> (*pArchive) << (*fit);
> }
> 
> 
> I ran into this same error when trying to use cout or cin.
> 
> Is this a compiler problem, preprocessor problem, missing 
> headers?
> 
> I'm using VC++ 6.0 Service Pack 5.
> 
> Any help is greatly appreciated...
> 
> Thank you one and all for any help you can lend!!

0
lsiddens1 (7)
10/21/2003 2:05:33 AM
Hey...

Thanks for the reply.

The *fit operator is a struct.  It includes

CString FileName;
FILETIME LastWritten;
unsigned __int64 size;
CString FileVersion;

In this case it is probably easier to output each of them 
separately isn't it?  I'll give it a shot and keep ya 
posted.

Thanks!



>-----Original Message-----
>What is the type for fit?  Is it a vector (from the 
STL?)  If so, then 
>there are several options.  One, you overload the vector 
class and add 
>the operators so you can output them.  Or, you can 
output them individually.
>
>But, we will need to know what type fit variable is.
>
>Larry
>
>Tojam wrote:
>
>> Hey all, 
>> 
>> I'm running into a problem with using the << or >> 
>> operators when using cout, cin, or CArchive.
>> 
>> It keeps telling me, in the most recent case:
>> 
>> error C2678: binary '<<' : no operator defined which 
>> takes a left-hand operand of type 'class CArchive' (or 
>> there is no acceptable conversion).
>> 
>> The offending line of code tries to write 1 item from 
a 
>> vector (*allfile) to the archive (*pArchive) like so...
>> 
>> try {
>> (*pArchive) << (*fit);
>> }
>> 
>> 
>> I ran into this same error when trying to use cout or 
cin.
>> 
>> Is this a compiler problem, preprocessor problem, 
missing 
>> headers?
>> 
>> I'm using VC++ 6.0 Service Pack 5.
>> 
>> Any help is greatly appreciated...
>> 
>> Thank you one and all for any help you can lend!!
>
>.
>
0
anonymous (74722)
10/21/2003 2:17:48 AM
hi,
   As you posted you can write each element seperately, but I would 
suggest that you do it by implementing the << and >> operator in the 
structure. Also you might want to think about deriving the structure 
from CObject so that versioning support can be added.
regards
gangadhar npk
Tojam wrote:
> Hey...
> 
> Thanks for the reply.
> 
> The *fit operator is a struct.  It includes
> 
> CString FileName;
> FILETIME LastWritten;
> unsigned __int64 size;
> CString FileVersion;
> 
> In this case it is probably easier to output each of them 
> separately isn't it?  I'll give it a shot and keep ya 
> posted.
> 
> Thanks!
> 
> 
> 
> 
>>-----Original Message-----
>>What is the type for fit?  Is it a vector (from the 
> 
> STL?)  If so, then 
> 
>>there are several options.  One, you overload the vector 
> 
> class and add 
> 
>>the operators so you can output them.  Or, you can 
> 
> output them individually.
> 
>>But, we will need to know what type fit variable is.
>>
>>Larry
>>
>>Tojam wrote:
>>
>>
>>>Hey all, 
>>>
>>>I'm running into a problem with using the << or >> 
>>>operators when using cout, cin, or CArchive.
>>>
>>>It keeps telling me, in the most recent case:
>>>
>>>error C2678: binary '<<' : no operator defined which 
>>>takes a left-hand operand of type 'class CArchive' (or 
>>>there is no acceptable conversion).
>>>
>>>The offending line of code tries to write 1 item from 
>>
> a 
> 
>>>vector (*allfile) to the archive (*pArchive) like so...
>>>
>>>try {
>>>(*pArchive) << (*fit);
>>>}
>>>
>>>
>>>I ran into this same error when trying to use cout or 
>>
> cin.
> 
>>>Is this a compiler problem, preprocessor problem, 
>>
> missing 
> 
>>>headers?
>>>
>>>I'm using VC++ 6.0 Service Pack 5.
>>>
>>>Any help is greatly appreciated...
>>>
>>>Thank you one and all for any help you can lend!!
>>
>>.
>>
> 


0
10/22/2003 1:52:20 PM
Reply:

Similar Artilces:

"parameter values are not vaild" error message when trying to se.
I'm trying to send test emails, and I get a "could not complete operation" box with the error message, "One or more parameter values are not valid." How do I fix this? I would double check your e-mail account settings (e.g. account name, password, POP3/IMAP servername, SMTP server, e-mail address) in Microsoft Outlook to make sure they are filled out correctly. "Sarah" <Sarah@discussions.microsoft.com> wrote in message news:CF4C5632-C855-42E4-AD47-09CF15158E3D@microsoft.com... > I'm trying to send test emails, and I get a "could not c...

How to use PowerPoint template in my application
Hi all: I want to read some data from database then use PowerPoint template to create ppt file . How can I use this ? Thanks in advance ! Best regards . ...

What Event To Use
I have a form that may contain multiple records (part numbers) in it. In the form I have a boleen that identifies if the record is exists else where (IE another manufactured location). I want to change the property of a lbl to be visible (Not visable by default) if the boleen is true. The boleen is already set in the underlying data so that is not the problem, I just simply need to know the event that will test a statement after a record is changed. thanks! Robert_DubYa wrote: > I have a form that may contain multiple records (part numbers) in it. In the > form I ha...

Outlook 2002
I am getting "The operation failed." error message when I try to: Send/Receive All Press F9 Click the Send/Receive Button I have attempte a Repair as well as a remove reinstall. Suggestions? See if http://support.microsoft.com/default.aspx?scid=kb;en-us;312354 helps. -- Jeff Stephenson Outlook Development This posting is provided "AS IS" with no warranties, and confers no rights "Paul McCone" <mccone@mcconeconsulting.com> wrote in message news:084001c358fb$dd14f680$a301280a@phx.gbl... > I am getting "The operation failed." error message...

Operation failed error when opening attachment
A customer of mine sometime gets the error message 'The operation failed' when opening an attachment. This has been seen for .xls and .zip files from a particular source. If outlook is closed then re-opened, the attachment opens fine. Also, if the same file is sent again, the copy will open. I posted this message once before and it was suggested to me that there may be a problem with the secure outlook temp folder. I have followed the instructions given to empty this folder, but this has not resolved the problem. Even directly after emptying the folder, the customer experienced a ...

Read XML using VB6 DOM 4.0 with Namespaces
Here is the XML sample <?xml version='1.0' encoding='UTF-8'?> <nvd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rec="http://www.mysite.com" xmlns:cvss="http://myschoolsite.com"> <entry id="01-2345"> <rec:last-modified>2008-09-05T17:34:06</rec:last-modified> <rec:cvss> <cvss:base_metrics> <cvss:score>5.0</cvss:score> <cvss:grade>6th</cvss:grade> </cvss:base_metric...

Error 2007
Help!!! This macro used to work perfectly fine. Nothing has changed. All of a sudden, I am getting a type mismatch(error 2007). I don’t know how to fix this. Sample of my code: Range("A4").Select With ActiveSheet.PivotTables("PivotTable4").PivotFields("ST-LOC-NUMB") .PivotItems("(blank)").Visible = False End With Range("A1").Select ActiveCell.FormulaR1C1 = "=AVERAGE(R[2]C:R[9998]C)" Range("A1").Select Selection.autofill Destination:=Range("A1:M1"), Type:=xlFi...

Compile errors in function when converting from 97 to 2000
I am trying to convert an Access 97 mdb file to 2000...I got a compile error and when I run the debugger it stops at this function... It highlights the last section...RankCheck = result ....error states...Function call on lefthand side of assignment must return Variant or Object. Any ideas on what it should be changed to? Public Function RankCheckOrig(current_value As Integer) As Integer Dim previous_value As Integer Dim previous_rank As Integer Dim result As Integer previous_value = Forms![Rankvariables]![previous_value] previous_rank = Forms![Rankvariables]![previous_rank] If current_v...

POP3SVC Error
Hello, The Exchange 2003 Sp1 mail server shows the following error in the application log, Event Type: Error Event Source: POP3SVC Event Category: General Event ID: 1051 Description: Unexpected error condition: call to function CEncryptCtx::CheckServerCert() resulted in error code 0x800cc801. Microsoft knowledgebase article kb275291 suggests that the client is trying to use SSL. SSL is configured and its working fine. Any idea why this error is getting generated ? Thanks, Elan On 6 Feb 2006 06:07:31 -0800, "Elan" <elangumaran@gmail.com> wrote: >Hello, &g...

Error 0X800CCC0B
I posted this question a month ago and still have no real solution. When opening my mail my default account opens and my calender is updated and my secondary e-mail shows Subject Error saying mail from that account cannot be sent or received. When I Sync. that account the e-mail from that account is received and I can send with no problems. I have tried one suggestion and stopped signing in since I do not use the calender and the error message is no more. Without sign-in however I have no Contacts List which I do like to have. I have been living with this problem using the Sync b...

XmlValidation Errors int TreeView Control
I show some Xml file in Windows TreeView control. Wenn I validate Xml with some Xml-Schema, I have to show errors node with red color. How can I find an element name, which causes an Exception of XmlValidatingReader? In XmlValidatingReader, you can not determine the element/attribute name which caused the error but you can find out the line number and position where the error occured. This information is available on the XmlSchemaException, if you have hooked up a validation event handler. Zafar "nataly" <nataly@discussions.microsoft.com> wrote in message news:7E9753AE-4...

Error Message #9
Hello ! I am receiving an error message, "File format is not valid" when trying to open an excel file located on the network. This file was created to reserve equipment and/or boardrooms within the organization. What must I do to correct this problem? Hmmm... does the message say anything else? what version of Excel are you using? can other users in your company open that file? Sean ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ Sometimes excel w...

Disable Recently Used Menu Options
How do I disable the option that only shows the most recently used men options. I want Windows to to show all menu options whither I hav used it before or not. It is a setting in the control panel but can't seem to find it. I have Windows XP. Thanks in advance. M -- Message posted from http://www.ExcelForum.com Right click on menu bar. Select Customize. Uncheck the "Menus show recently used commands first" option. Stephani -- Message posted from http://www.ExcelForum.com ...

MSComm use in VC 6.0
Hello. I am using MSComm in my VC 6.0 application, for using the COM1, and COM2, etc... ports. (It has a telephone glyph - the activeX name is : Microsoft communication control). By class wizard I have added a member variable of the name : m_com_port for that control. I need a sample for VC 6.0 for reading and writing to com port (may be com1, i.e), and some explanation on this component, please. Thanks :) Check out the VCTERM sample in the MSDN documentation. The wrapper classes in the sample were originally created with VC5, and the control has been modified since then to support diff...

Asking Excel Solver to use binaries, but selects other values
I am trying to get a linear program solved using solver. The values that Solver needs to enter are contrained as binary, but excel still try to find values that are neither 0 or 1. Stephane, I assume that when you say it is selecting values that are neither 0 or 1, they are values that are numerically close to 0 or 1 (such as 0.99998). If this is the case, you may want to consider the following approach: 1. Have the Solver constrain your decision variables as binary. 2. Have another set of cells which uses the decision variable to produce a result. When the underlying decision variabl...

Error message when retriving a string from my xml file in C#.net a
I created the following code in my C# program but it's giving me error message at run time of : XML.XPATH.XPATHEXCEPTION : Namespace Manager or XSLTContext needed. This query has a prefix, variable or user defined function. Can someone see what I'm doing wrong? Thanks, Alpha private XPathDocument unityMessages = new XPathDocument("UnityMessages.xml"); unityMsgNavigator = unityMessages.CreateNavigator(); string query = @"/trans-unit[@id=""m1""]/target[@xml:lang=""fr""]"; XPathExpression queryM1 = unityMsgNavigator.Co...

using excel to change filenames
i have several hundred files on my HD for a certain program i use and i would like to change all of their filenames, is it possible to import them into a spreadsheet, manipulate the file names with some formulas ans use the manipulated names to rename the files? spence It's fairly easy to do it in DOS, but it would mean doing it one directory at a time. Is that any use? Andy. "spence" <spence524@carolina.rr.com> wrote in message news:1a2d01c352b0$9ca90470$a001280a@phx.gbl... > i have several hundred files on my HD for a certain > program i use and i would like ...

Microsoft CRM Unhandled Error 06-07-06
Started recieving this error message when trying to perform searches... ================================= Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin ...

does anyone track where and how MS uses FUD?
does anyone track where and how MS uses FUD? has anyone wrote a book on it? Frequently Used Data is maintained in a memory cache, and is cleared at logoff. IRS Intern wrote: > does anyone track where and how MS uses FUD? > > has anyone wrote a book on it? > Ah - I was thinking "Fear, Uncertainty and Doubt". In article <u09Rek3hHHA.1216@TK2MSFTNGP03.phx.gbl>, Bob I <birelan@yahoo.com> wrote: > Frequently Used Data is maintained in a memory cache, and is cleared at > logoff. > > IRS Intern wrote: > > > does anyone track where...

linking machine datasource to MySQ,import tableL-error
Hi I am able create a machine datasource using a MySQL ODBC driver but when I select import and try to import data I get the error , Microsoft Access reserved error (-7701). I used the same driver around 6 months ago and it worked fine. Thanks. -- Paul G Software engineer. Just a bit more information. I ran a trace and get the following, looks like a bad pointer, could it be running out of machine memory! MSACCESS 714-6cc ENTER SQLSetConnectOption HDBC 083715E8 SQLINTEGER 103 <SQL_LOGIN_TIMEOUT> SQLPOINTER 0x00000014 MSACCE...

Error when accessing System Settings
When System Setting is selected under Organization Settings we receive the errror: "The underlying connection was closed: Could not establish trust relationship with remote server" I am not seeing this error in other areas of the system. ...

Outlook 2000
The file P:\outlook.pst could not be accessed because another workstation has modified it. Close and then restart all mail-enabled applications. This error occurs while Outlook is open and in use, the .pst file is on a network drive. I have users getting this error messages several times a day and it shuts down their Outlook and closes out. NT 4.0 and W2k Pro clients. ...

Force From field to use different name
Hi, is it possible to force the from field of a message to use a different name? I have a user who receives resumes - she would like to send a notification that a resume has been received but not show her own name in the From field, just a generic "Resume Receiver" or something but only for that message only. All other messages from her should show her real name. Your help appreciated!-- Thanks, GillianHG You sure you meant to post in an excel newsgroup??? GillianHG wrote: > > Hi, is it possible to force the from field of a message to use a different > name? &g...

internet explorer mime type resubmit to window error
I have an web-app that can produce a receipt by submiting a html table into a new window and setting the mime type to Excel. This functionality works fine. If the user does not close this window and goes to create a new receipt then the excel plugin within explorer simply copies the data within the previous window into the new window and ignores the new data. Is there any solution to this problem? First, I don't know what I'm talking about. Second, it does sound like some kind of caching problem. Is there anyway you can force the web application to refresh the cached data? ...

Configuring Exchange 2000 to use SPF records...
Does anyone have any information on how to configure Exchange 2000 to use SPF records? Our ISP has configured SPF records at their end, and now I want our Exchange server to use them... However, we are using a smart host to relay our email through. I have read where this could be a problem with using SPF - however that article I read was referring to installing the GFI MailEssentials product to use SPF on your Exchange 2000 server - so maybe does not apply to all mail relaying in general if you are NOT using that product.. Does anyone know if SPF checking will work if you are using a s...