Click here to Skip to main content
15,924,507 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow do I get the size of a character array of unspecified size? Pin
David Z2-Sep-02 6:20
David Z2-Sep-02 6:20 
AnswerRe: How do I get the size of a character array of unspecified size? Pin
Maciej Pirog2-Sep-02 6:31
Maciej Pirog2-Sep-02 6:31 
GeneralRe: How do I get the size of a character array of unspecified size? Pin
Maciej Pirog2-Sep-02 6:34
Maciej Pirog2-Sep-02 6:34 
AnswerRe: How do I get the size of a character array of unspecified size? Pin
Chris Losinger2-Sep-02 6:35
professionalChris Losinger2-Sep-02 6:35 
AnswerRe: How do I get the size of a character array of unspecified size? Pin
Tomasz Sowinski2-Sep-02 6:40
Tomasz Sowinski2-Sep-02 6:40 
AnswerRe: How do I get the size of a character array of unspecified size? Pin
BlackSmith2-Sep-02 6:39
BlackSmith2-Sep-02 6:39 
AnswerRe: How do I get the size of a character array of unspecified size? Pin
David Z2-Sep-02 11:41
David Z2-Sep-02 11:41 
AnswerRe: How do I get the size of a character array of unspecified size? Pin
aritosteles2-Sep-02 18:11
aritosteles2-Sep-02 18:11 
Well...

Your array is actually a pointer, so the function sizeof() will always return
4 because that's the size of a pointer. Getting the number of elements in an
array is a different thing.
Now, I think you should do this some other way. First of all, why would you want to give the user unlimited input length? Just specify a limit and save
yourself a headache.
Second, maybe it could help to know the length of the array before allocating any memory... but, well, what is it you want to do?

Aritosteles

QuestionVS.NET VC7 generated code, where is it? Pin
TigerNinja_2-Sep-02 5:18
TigerNinja_2-Sep-02 5:18 
AnswerRe: VS.NET VC7 generated code, where is it? Pin
Tomasz Sowinski2-Sep-02 5:42
Tomasz Sowinski2-Sep-02 5:42 
AnswerRe: VS.NET VC7 generated code, where is it? Pin
shokisingh2-Sep-02 6:11
shokisingh2-Sep-02 6:11 
Questionwhy does this code fail? Pin
Brakanjan2-Sep-02 4:44
Brakanjan2-Sep-02 4:44 
AnswerRe: why does this code fail? Pin
Martin Ziacek2-Sep-02 4:49
Martin Ziacek2-Sep-02 4:49 
GeneralRe: why does this code fail? Pin
Brakanjan2-Sep-02 4:59
Brakanjan2-Sep-02 4:59 
GeneralRe: why does this code fail? Pin
Martin Ziacek2-Sep-02 5:16
Martin Ziacek2-Sep-02 5:16 
GeneralRe: why does this code fail? Pin
Brakanjan2-Sep-02 5:30
Brakanjan2-Sep-02 5:30 
GeneralRe: why does this code fail? Pin
Martin Ziacek2-Sep-02 5:33
Martin Ziacek2-Sep-02 5:33 
Generalmissing storage-class or type specifiers error Pin
Paul Silvernail2-Sep-02 4:29
Paul Silvernail2-Sep-02 4:29 
GeneralRe: missing storage-class or type specifiers error Pin
Tomasz Sowinski2-Sep-02 4:34
Tomasz Sowinski2-Sep-02 4:34 
GeneralRe: missing storage-class or type specifiers error Pin
Paul Silvernail2-Sep-02 4:43
Paul Silvernail2-Sep-02 4:43 
QuestionNo list? Pin
Brakanjan2-Sep-02 4:17
Brakanjan2-Sep-02 4:17 
AnswerRe: No list? Pin
benjymous2-Sep-02 5:28
benjymous2-Sep-02 5:28 
GeneralRe: No list? Pin
Martin Ziacek2-Sep-02 5:35
Martin Ziacek2-Sep-02 5:35 
GeneralRe: No list? Pin
benjymous2-Sep-02 6:48
benjymous2-Sep-02 6:48 
AnswerRe: No list? Pin
Michael Dunn2-Sep-02 8:20
sitebuilderMichael Dunn2-Sep-02 8:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.