Solved

Char [ ]

Posted on 1998-09-02
1
267 Views
Last Modified: 2010-04-02
I have a char [50] called buf, when I try:
buf = "D:\\Masks\\";
it tells me it can't convert a char[10] to char[50]
0
Comment
Question by:jtm082698
1 Comment
 
LVL 8

Accepted Solution

by:
Answers2000 earned 30 total points
Comment Utility
1. try

strcpy( buf, "...etc..." ) ;

 to do the copy

you need to #include<strings.h>

2. if you are initializing and never changing the string, you can do

char buf[] = "...etc.." ;

the buf string is then allocated to exactly the right size.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now