|
mrby123 wrote: f_ptr1.getline(buffer_seed,58,' ');
Why not read up to a newline character?
mrby123 wrote: qq = string(buffer_seed);
Why convert buffer_seed from a char[] to a string ? Can't the write() method handle a char[] type?
mrby123 wrote: f_ptr2.write(qq.c_str(),f_ptr1.gcount());
For the second argument, why not use qq.length() instead?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
write() can not handle char and I tested and got messy output.
qq.length() will be equal 60 (declared space)
getline seems read a line of information, because I write out a file exact the same as input file. However, the following code can only pring the first word of the line, not every word in the line. I do not understand.
f_ptr1.getline(buffer_seed,58,' ');
qq = string(buffer_seed);
istringstream stream (qq);
while(stream >> word) {
cout << word.c_str()<
|
|
|
|
|
mrby123 wrote: However, the following code can only pring the first word of the line, not every word in the line. I do not understand.
f_ptr1.getline(buffer_seed,58,' ');
Probably because only one word has been read from f_ptr1 into buffer_seed . You've instructed getline() to read up to the first space character.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
The problem has been fixed by:
char *tokenPtr;
f_ptr1.getline(buffer_seed,58,'\n');
qq = string(buffer_seed);
f_ptr2<
|
|
|
|
|
mrby123 wrote: However, my roblem now is how to detect whether tokenPtr is a digital number or character ?
Are you referring to isdigit() and isalpha() ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
would you give me segments of code for these functions?
|
|
|
|
|
I do not have space on my development machine, my project files are in 2000 server and VC++ 6.0 runs on the "client".
After adding new MFC class I deleted .clw file and tried to rebuild it.
I am getting an error that any of the project files cannot be accessed.
The error path looks like this “..\..\..server name\drive \.."
What’s with the "..\.." before the server name??
I can compile, debug and save the original project without any problems.
What am I missing?
Thanks for your help.
Vaclav
|
|
|
|
|
What is the error number/text?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi !
I have declare an array of characters like this :
char lStr[255];
But , i want to declare a bigger capacity of this array .
So i want to kow the maximum characters, i can declare in a array of characters ?
|
|
|
|
|
It'll be governed by the size of the stack, which I think defaults to 1MB.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I suggest using vector or, if in MFC, CArray. Both use the heap, instead of stack, and maintain the count.
Option 2 is to simply use:
char* pStr = new char[255];
But make sure you delete it when you got out of scope (or use a smart pointer class.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
this is certainly a stupid question for the ones of you who know the answer, but the fact is that i never went into multi-projects workspaces (under VC++ 6) / solutions (under VC++ .NET 2003).
there are 2 main cases where i want to do so :
1) one project is the main application UI, the other ones would be DLL project (needed by the GUI)
2) One project is the application, the other project would be a unit test project.
i don't know how to proceed neither one nor other case.
my simple question is : how are set/used the dependencies (say, for VS2003), so that i don't have to copy the classes files (headers && implementations) from one project to the others ?
thanks to all of you who can provide a useful information.
[edit]
I'll go in a simpler question if no one knows :
how do you design a solution which has several projects in it, where one need to use some classes defined in another project of the solution (without copying the files between the projects folder ; only by dependencies) ??
[/edit]
|
|
|
|
|
I am not sure if this is the answer. Try to use 'reference'. In vs2003, use
Project/Properties, then at 'References' in "Common Properties", using "Add new reference" also set the path to the other projects. In the new window, select the correponding project you need, then it is done.
|
|
|
|
|
i already tried that... but i cannot use it correctly... any deeper help ?
|
|
|
|
|
can anyone help me to find a good beginner's tutorial on Win32? i want to learn how to code using win32.
thanx in advance
|
|
|
|
|
Petzold has a good beginner's book.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi writing a VC++ 6.0 application and I need to obtain the status of a printer and PRINTER_INFO_2 structure does not work, so I'm looking for some example code that uses SNMP MIB I know it is possible to query the printer to obtain this info but how in C++ using SNMP ?
Any info/inks etc would be appreciated
|
|
|
|
|
P Gibson wrote: ...I need to obtain the status of a printer and PRINTER_INFO_2 structure does not work...
What is it that you are looking for that is not in that structure?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi David, thanks for the quick reply, my application always retruns in the status dword 0 ... even when the printer is offline, or the printer has the top cover open, or a tray open it always returns 0.
|
|
|
|
|
What does your code snippet look like?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I've emailed the code snippet
|
|
|
|
|
Hello.
How can I find out what files on my computer are being modified? And not by scanning every file. Something like task manager maybe...
Thanx.
nothing
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanx. But that is an executable. I was searching for some source code, or even some main directions so that I can build my own '.cpp'. I only need the path of the files in the form of a string.
Alin Stoian
|
|
|
|
|
It helps to be as specific as possible. That article goes on to say what is required. Creating device drivers is no trivial task.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|