473,664 Members | 3,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CString array problem

100 New Member
Hi,
i am using the CString array to hold some values...
Is it right to do this..
CString t[]=new CString[];
But i am getting errors...
Please help...
Jul 12 '07 #1
2 2651
Meetee
931 Recognized Expert Moderator Contributor
Hi,
i am using the CString array to hold some values...
Is it right to do this..
CString t[]=new CString[];
But i am getting errors...
Please help...
Can you write those errors here?

Regards
Jul 12 '07 #2
weaknessforcats
9,208 Recognized Expert Moderator Expert
CString t[]=new CString[];
This syntax: CString t[] creates an array. t is the address of element 0.
This syntax: new CString[] allocates memory and returns a CString* to element 0.

You cannot assign an address to the address of a local variable. Doing so would allow you to change the address of the local variable.

The correct syntax is:
Expand|Select|Wrap|Line Numbers
  1. CString* t=new CString[];
  2.  
Jul 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
24519
by: Markus Hämmerli | last post by:
I ' ll tra to convert a Cstring to char* without success. I working in a Unicode enabled environment this is working in Unicode CString source = _T("TestString"); TCHAR *szSource = source.GetBuffer(0 ); but i need a char* and so this is not working CString source = _T("TestString");
8
2304
by: Oskar | last post by:
Hi. I`m new in cpp and i have a litlle problem. i have a CString from Edit Box (eg."aaa bbb ccc 7327373 d feaf 323 dvjiv 234") and i want to put the data (space separated) into an array.It shuld be somethign like this. array1="aaa"; array1="bbb"; .... array1="234";
1
649
by: romi | last post by:
Hi I have a problem, I want to convert program in Visual Basic 6 to VC++6. Program in VB works OK., but in VC++ I don't know how to convert 'VARIANT' to 'Cstring'. How to convert 'VARIANT ww' to 'CString pp' In C++ debug info I have: ww={???} ww.vt=8204 pvarVal={VT_NULL}
5
14069
by: Tim Wong | last post by:
All: I am trying to convert a CString value to an unsigned char array. I found some code online that will allow me to compile, but when I try to print out...i get a whole mess. /*Begin Code*/ CString day("01"); unsigned char testDay;
3
9134
by: nsyforce | last post by:
What is the correct way to convert a const char* to a CString? I'm somewhat of a newbie and have tried several ways. While they all convert ok, I'm using a profiler that shows a memory leak for every option. Here's what I have tried: const char* test; test = getMyChar(); //CString myCString((LPCTSTR)test); //CString myCString(test); CString myCString = new CString(test);
7
8222
by: Klaus Bonadt | last post by:
I have an existing VC6 application using the MFC. I am able to pass CString and other parameters from such a VC6 dll to an unmanaged MFC dll (compiled in Visual Studio .NET). Now I want to use .Net functionality, i.e. calling methods in managed code. How do I pass CString variables for input and output usage, i.e. providing and retrieving char arrays? Regards, Klaus
4
11032
by: Cactus | last post by:
How to convert unsigned char* to CString: I wrote some function: u_char_ =55; u_char_ =66; u_char_ =77; .........=ii...... Convert_to_CS(u_char_);
2
5464
by: flyingxu | last post by:
Hi, I run into a cstring related link problem in VC7. My solution has 3 projects, one MFC exe, two MFC extersion DLL. the two MFC extersion DLL export functions which use CString as parameters. Everything is fine in VC6. Now I want to upgrade the solution to VC7, but I got lots of link error like this, /* WinGPC5.obj : error LNK2019: unresolved external symbol "public: static
3
2988
by: Jason .Y | last post by:
Hi~I'm planning to make a smiple program to upload file,but I've traped by a strange problem,here is a chip of my program: =========================================== LPCTSTR lpszMyFilePath =COptions::StoragePath+_T("\\test\\")+pWData- LPCTSTR lpszPeerFilePath = pWData->cFileName; UINT nMyTaskID = 0; nMyTaskID = WRMCC_RequestUploadFile (/*_T("\\´æ´¢¿¨\\test\
0
8437
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8778
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4185
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1759
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.