Hi ArkM,
Thanks again for the insight into the compiler. Its nice to know what's 'under' the hood, so to speak. I will study it.
I'm slowly progressing.
Is there a good site on line with info on the string library?
I need that 'good luck'
Hugh
Hi ArkM
Thank you for your reply. Please pardon my ignorance but I'm not sure what you mean by "refer to these (constant!) arrays of char with blanks",
I will use your suggestions for correcting my 2nd snippet. Could you give me a short example of using std::string input?
Thanks...
...output is just some spaces. What's happening to what I type in?
//checkarr1
#include <iostream>
#include <fstream>
using namespace std;
char *ar1[2]={" "," "}; //
int main()
{
cin>>*ar1[0] ;
cout<<*ar1[0]<<" this is it "<<endl;
return 0...
I'm using Visual C++ and
#include <iostream>
using namespace std;
I initialize a pointer to char at compile time with
char *can1[2]={" "} ;
If I try to write to it I get an error that the memory cannot be written
So then I tried getting new memory at runtime with
for...
Hi Blazero,
Do you mean my 'method'?
I thought I would step through the string , character by character and find the line breaks. That's it.
Since I'm only a beginner with C++ this is all I could come up with.
I'll study your example. It certainly looks more compact.
I've been reading about...
I'm trying to find the number of newline characters in a simple string but keep getting 0 for the variable numline.
What can I do to find the two little newline commands?
Here is my code:
(as you can see I'm a beginner)
//stringstep
#include <iostream>
using namespace std;
int endline=0 ...
Hi vladibo,
See my post to Zeit.
I will try what you suggested.
I don't know what include file is necessary for Console::Writeline . I'll look it up
Thanks
Hugh
Hi zeitghost
No you aren't missing something. Its got to be me.
I was trying to initialize a 2 dim array and if I didn't make a pointer, as in my first post I got an compile error.
I was further confused by the fact that I can get the values of the array elements with out the dereferencing...
Hi vladibo,
Thanks for the quick respone.
I'm lost here . If I try sizeof(myarray) / sizeof(myarray[0])
I get 2 . Surely the whole array can't be 2 bytes?
I did myarray[2][2] to make a 2 dimensional array. Maybe this is the wrong way to initialize a 2 dim. array?
I thought the whole...
I initialize an array as follows and get a sizeof( ) 16 .
From what I've read I should get the size of the whole array.
char *myarray[2][2]={"c:\\bigfold\\subfold\\pracnotes.dbf",
"c:\\pracnotes2.dbf",
"c:\\bigfold\\subfold\\pracnotes.fpt"...
Thanks for the code sample. I will give it a try and check out the windows.h header. I take it that FindFirstFile() is part of the windows.h header?
Hugh
I need to get a list of text files on a: drive . How can I do this?
I will then load the file names into an array in order to open each file and then append to another text file.
Thanks for any ideas.
hi ArkM,
Thanks again for the examples. I will try them both. I certainly need to learn more.
Since my last post I tested a few other examples and they all messed up at exactly the same spots in the header part of the file.
Do you recommend B. Stroustrup's book for learning C++? What...
Hi ArkM
I will try what you suggest. I not sure how to code what you suggest re ios::binary or the setbuf.
I had looked at Microsoft for a copyfile function but couldn't find it . Thanks for that sample I will try it.
I also compared the copied file ( made by using the code in my original...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.