|
I have good at math. But now I am a Network Administrator, I knowlege about OS and TCP/IP and security. Iwant to faster become a good C++ programmer. Please help me ? what will I do ?
Thank you !
Ngo Hong Quyet
|
|
|
|
|
READ CODE WRITTED BY OTHER MAN.
|
|
|
|
|
i agree with him. I don't have any CS background but reading other poeple's code and some books i am active coder now.
Good suggestions. Worked for me
paracha3
|
|
|
|
|
Thanh you !
Can you give me some template code or some link !
Ngo Hong Quyet
|
|
|
|
|
Hello everybody,
I have a problem in VC6. I have downloaded core sdk 2003.
I am not sure whether I installed it properly
or not. After download was completed, I ran setenv.bat .This bat file
I didnt have in my machine and copied only that file from another machine.
Any path setting should be done? how to do it?
can anyone help me?
When I run my application I get an error C2065: undeclared identifier.
regards,
shezz
|
|
|
|
|
I make soft for smartphone in evc4.
And it has not a customer wizard application,I can not make a awx file for my IDE.How could I do this?
lost my way
|
|
|
|
|
ok how do you load text from a text file to memory or somewhere so I could do a search on it for a specific character, can anyone help me, also how can you tell which line your on, THANKYOU SO MUCH everyone...
IF IT DOES THE THINGS I WANTED THE PROGRAM TO DO, I WILL POST THE ARTICLE ON CP.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
The text file = "Data.txt"
123
4567
89;
135
2468
The sample code...
#include <iostream>
#include <fstream>
void main()
{
std::ifstream MyFile("Data.txt");
MyFile.seekg(0, std::ios_base::end);
int iEnd = MyFile.tellg();
MyFile.seekg(0, std::ios_base::beg);
int iStart = MyFile.tellg();
int iSize = iEnd - iStart;
char* p = new char[iSize + 1];
MyFile.read(p, iSize);
int iLine = 0;
if(iSize)
iLine = 1;
for(int i = 0; i < iSize; i++)
{
if('\n' == p[i])
iLine++;
if(';' == p[i])
std::cout << iLine << " lines\n";
}
MyFile.close();
delete []p;
}
Then you can do yourself to make the code more stylish, more modularized...
Maxwell Chen
|
|
|
|
|
Thankyou again, I have one more question for today , how can you add the lines until the first ' ; ' and then see if there are others after it, if so then how many lines after that and then do it again until it reaches end of file. Store the number of lines to a seperate variable for furthur finding, would be great if it would be an array? AGAIN THANKYOU!!!;P
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
I recently was in a little discussion and a question came up.
Does a variable that is passed by reference have the same address as it would if it was pointed to?
How would I prove or diprove this?
Thanks for the help in advance.
Jeff Patterson
Programmers speak in Code.
http://www.anti-dmca.org[^]
|
|
|
|
|
Yes they are. To prove it:
BOOL TestAddr(int& ref, int* ptr)
{
return (DWORD)&ref == (DWORD)ptr;
}
void main()
{
int n;
assert(TestAddr(n, &n));
}
|
|
|
|
|
|
<br />
void f(int& v)<br />
{<br />
printf("var in function: %u\n", &v);<br />
}<br />
<br />
int main()<br />
{<br />
int v;<br />
printf("var in main: %u\n", &v);<br />
f(v);<br />
}<br />
If these outputs are the same, then the pointers are the same. These HW assignments are fun. Even a monkey could do them.
J.
----------------------------
|
|
|
|
|
Thanks, this and the other response were exactly what I was trying to prove. Unfortunately I'm not proficient enough to have done this myself.
Thanks again.
Jeff Patterson
Programmers speak in Code.
http://www.anti-dmca.org[^]
|
|
|
|
|
A reference is nothing but a constant pointer.
|
|
|
|
|
All,
I am very new to Visual C++ as my experience has been with VxWorks in embedded real time systems. So, I am a bit overwhelmed with the steep learning curve that I am facing.
I have spent a couple days getting an example program to run. This consists of a small form with a main menu that has a pulldown with a couple selections. There is a button on the form that displays text in a message box when selected. The first pulldown I use to open up a file open dialog box which passes back a file name. The good news is that there is only 1 more thing that I need to integrate at the moment.
When the user selects the file I need to open it up and do a bunch of processing, looking for certain information and outputting it for the user to see. The files are huge (50GB) and contain binary data. Finding the data that I need and converting it to readable form via something like printf is not the problem. What I am wrestling with is how to display that data in a GUI window.
Ideally I would like to have a "pane" in the lower portion of my main form that I use that would contain a scrollable section where I can dump the data and let the user look at it. This would be very similar if not identical to the build or debug pane that exists in the Visual C++ development environment. Where the compilation information goes. That is exactly what I want.
The problem that I have is that there doesn't appear to be any "windows components" that I can easily slide over from the toolbox that perform this function. I have read a bunch of material about creating separate windows and then sending messages to those windows, but that is not ideal. I also have read about the CSplitterWnd Class that allows for the user to split and resize windows to display several views of the same document. This is overkill for me. I just want a running log of the printf equivalent stuff that I want the user to see, in a window that he/she can scroll up and down to view all the contents.
If anyone can point me to the information in the MSDN library or online I would greatly appreciate it. Any pointers to code samples would be very helpful too as I'm a native C programmer and the Visual C++ takes some getting used to.
Thanks,
Robert
|
|
|
|
|
Maybe Ive got it wrong what exactely you're looking for, but I've used http://www.flounder.com/logctl.htm[^]before - he has posted it here to CP as well...
this'll help with the logging part ....
(there are other logging articles on cp as well)
hth
|
|
|
|
|
Garth,
Thanks, this is perfect! What is CP though? I would like to explore other solutions too.
Robert
|
|
|
|
|
|
I have to convert some integers into hexadecimal string format and then convert them back in later process, there's no problem until I encountered negative integers then things messed up:
int nOffset = -2600;
TCHAR sz[32] = _T("");
_stprintf(sz, _T("%X"), nOffset);
nOffset = _tcstol(sz, NULL, 16); And the value of nOffset becomes 2147483647, not -2600 as I expected.
How can I solve this problem? Thanks.
|
|
|
|
|
use _tcstoul() instead of _tcstol()
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thank you man! I can't believe how lame I was...
|
|
|
|
|
I think the format converts it to unsigned long by default anyways. The large number is just how a negative number is expressed. It is (0xFFFFFFFF - 2600). If you want it to act as needed you must do it yourself:
_stprintf(sz, _T("%s%X"), (nOffset < 0 ? _T("-") : "", <br />
(nOffset < 0 ? -nOffset : nOffset);
J.
----------------------------
|
|
|
|
|
Thank you for the reply, but I have to make sure that the result string does not exceed 8 characters long, so the "-" cannot be added. I used PJ Arends's method and it worked perfectly. Thanks again.
|
|
|
|
|
I need this in c++ console.
<marquee>Universal Project... Soon to be a .net
|
|
|
|