|
Hi, when i first tried the above code on a new empty project, it worked without any problems.(after including the ATLComTime.h)
But i finally modify and use it in my intended solution and i have 4 errors and 4 warnings:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : warning C4935: assembly access specifier modified from 'public'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(258) : warning C4935: assembly access specifier modified from 'public'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7408) : error C2872: 'IDataObject' : ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : System::Windows::Forms::IDataObject IDataObject'
or 'stdafx.cpp(0) : System::Windows::Forms::IDataObject'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7422) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Form1.cpp
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : warning C4935: assembly access specifier modified from 'public'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(258) : warning C4935: assembly access specifier modified from 'public'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7408) : error C2872: 'IDataObject' : ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : System::Windows::Forms::IDataObject IDataObject'
or 'stdafx.cpp(0) : System::Windows::Forms::IDataObject'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7422) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Generating Code...
Can you figure out what I might nid to do? Tks
|
|
|
|
|
Thanks y'all,
I tried the various ways and i'm glad with the results.
Regards...
|
|
|
|
|
How to pick-up a specal word from a string ?
I like to interrogate words from line by line from a file.
How to pick-up numerical numbers from a mixture of letters and numerics ?
|
|
|
|
|
I have found using Regular Expressions to be very useful in doing this. You can find Regular Expressions implementations in Microsoft's ATL and the Boost Library (http://www.boost.org). They are a little hard to learn but worth the effort.
|
|
|
|
|
Thanks.
Do you have any code segments for reference ?
Thanks
|
|
|
|
|
#include <iostream>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;
int main(int argc, char* argv[])
{
regex e("The .*");
if ( regex_match("The quick brown fox jumps over the lazy dog!", e) )
{
cout << "Match!" << endl;
}
return 0;
}
Steve
|
|
|
|
|
|
I met link error when using DLL. I created the DLL and corresponding lib in Visual studio 2005, and parts of codes are in c not c++, and I did not include "extern "C"" in building dll. As I used DLL and lib in the application, error message occured:
error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl voidtry(int)" (__imp_?voidtry@@YAXH@Z) referenced in function _main
Because in creating DLL, some c codes are used, I do not know whether I should use "extern "C"" declaration to those export function. Another thing is that in building DLL, those export functions are dependent on some functions in c code, should I add "__declspec(dllexport)" to those c code functions? Thanks for your help.
|
|
|
|
|
I don't have answer to your question. But if you suspect that by using extern "C" it might work then why not try it?
-Saurabh
|
|
|
|
|
I think that you may forget to add your lib name to the project as additional library. or you forget to set the dependence of project when you develop application and DLL in the same solution.
//////////////////////////////////////////////
maybe right , maybe wrong
|
|
|
|
|
Thanks for your suggestion. I added the DLL and Lib in the application program directory, also I used the code "#pragma comment(lib, "aacresample.lib")" to include the lib. When build the program, I copied other c files, and head files in my directory, so I did not set dependence of project. BTW, I rebuilt the lib adding "extern "C"" declaration. But I still got the same link error.
|
|
|
|
|
It looks odd to me that VC++ .NET 2005 adds a new function to a different cpp file.
I have a folder (named as Dialogs) which stores a bunch of header and cpp files of dialogs in a project (MyApp) folder. When I right click mouse in Class View to add a new function to MyDialog class whose header and cpp files are in Dialogs folder within MyApp folder and click OK, Visual Studio automatically adds the definition of the function to the correct header file, however, it adds the function implentation codes to a new cpp file right in the MyApp folder instead of MyDialog with the same name of the class. In order to have VS correctly place the codes to the cpp file under Dialogs folder, I have to specified the location of cpp file in the Add-member-function-wizard. This means that every time I want to add a function to a class whose cpp file in NOT directly under the default project folder (MyApp in this case), I have to explicitly specify location of its cpp file . This is annoying and is NOT the behavior of VS 6.0.
Anyone knows a way to fix this or this is the way VS .NET 2005 is?
|
|
|
|
|
ofstream f_ptr2;
string qq;
while (....)
{
f_ptr2.write(qq.c_str(),qq.length());
}
I found the above code continueously write in one big line. How to write a new line each
time when while repeat ?
|
|
|
|
|
std::endl will give you a new line, write it between each line.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Why not do it like this:
f_ptr2 << qq << endl;
Using c_str and length is not needed.
Steve
|
|
|
|
|
|
Hello, i'm in a desperate need to get a hold of the sdk for the PalmOS v3.5.
Does anyone know where i can find this, I’ve googl'd all i know about the subject and still haven’t found anything, but the sdk for it on Linux / Unix, but i need it for windows xp -> Visual c++.
If someone can please post for me a link to it I’ll be very grateful.
Thank you.
|
|
|
|
|
GreenLantern wrote: windows xp -> Visual c++.
Visual C++ does not do cross-compiling.... (at least for Palm -- a competing environment) You can find the development suites for various cross-compilers and embedded development, but not for Visual C++.
http://www.palmos.com/dev/tools/c_cplusplus.html[^]
PRC-Tools is GCC based, but for windows also. Codewarrior is the standard for Palm development.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-- modified at 16:38 Wednesday 15th March, 2006
|
|
|
|
|
Hi
When using GetFieldValue to get a CString value in UNICODE the CString size is twice the length of the string because the CRecordset uses SqlGetData odbc api that returns the number of bytes copied to buffer and not the number of WCHARs. So when CRecordset issue a CString::ReleaseBuffer(SqlGetDataLen); the CString becomes with twice the size of the real data. Making use of CString += results in bad strings ...
PS.: This problem exists in MFC 7.1 and 8.0
My way to resolve this is calling CString::ReleaseBuffer(-1); again after call GetFieldValue.
There is a Microsoft fix for that ?
|
|
|
|
|
here I put some code to interrogate each word of the line, my intention is to print each word in the line, but I only get the first word of the line. I do not know what wroght with my code.
//
string line,word;
f_ptr1.getline(buffer_seed,58,' ');
line = string(buffer_seed);
istringstream stream (line);
while(stream >> word) {
cout << word.c_str(); }
For example, I should have pring every word of the line: "Eventyy Type : Full Waveform",
but I only print "Eventyy.
Thanks for the help
-- modified at 13:10 Wednesday 15th March, 2006
|
|
|
|
|
mrby123 wrote: f_ptr1.getline(buffer_seed,58,' ');
Does buffer_seed contain the correct value?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
buffer_seed is char (char buffer_seed[60];)and contains the characters of the current line,
read by: f_ptr1.getline(buffer_seed,60,' ')
|
|
|
|
|
mrby123 wrote:
buffer_seed is char (char buffer_seed[60]and contains the characters of the current line,
read by: f_ptr1.getline(buffer_seed,60,' ')
Are you sure? The getline() call specifies a space as the delimeter.
So have you verified that line also contains the correct value?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks.
My intention is to use getline to read one line. what is the delimeter should I use ?
I think this is the key. Maybe the getline only reads a word each time with curent code?
With the folowing code I read a file and write it into another file with the same format.
while (! f_ptr1.eof())
{
// f_ptr1.getline(buffer_seed,58,'"\n"');
f_ptr1.getline(buffer_seed,60,' ');
f_ptr2.write(qq.c_str(),f_ptr1.gcount());
}
|
|
|
|