|
Immunity18 wrote: m_FolderName = "C:\dsadasdxzc\";
Shouldn't the string literal have double backslashes?
Why are you not checking the return value of FindFirstFile() ?
Going back to what I asked earlier, why not use the CFileFind class?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Right now I'm creating a program that declares a structure, which also has enum inside it. Now I believe I declare the structure right, but the next step is to create a loop that has the user enter 5 different items of data for library information. But I have to use pointers, so when the loop runs and I enter the information, the data has to be sent to a structure variable only once all six attributes are entered, and the pointer values should be used to create the structure.
I was given an example:
cin >> a;<br />
cin >> b;<br />
library.dewey = &aptr;
This is my code so far:
struct card_catalogue
{
float dewey;<br />
string title;<br />
string author;<br />
int released;<br />
int num_pages;<br />
enum type {fiction, nonfiction, reference, pond};<br />
};<br />
<br />
int main()<br />
{ <br />
card_catalogue books;<br />
<br />
<br />
cout<< "Enter the Dewey Decimal Number please: ";<br />
cin>> books.dewey;<br />
cout<< "Enter the Title of the book please: ";<br />
getline(cin, books.title);<br />
cout<< "Enter the Author of the book please: ";<br />
getline(cin, books.author);<br />
cout<< "Enter the Year of Release please: ";<br />
cin>> books.released;<br />
cout<< "Enter the Number of Pages please: ";<br />
cin>> books.num_pages;<br />
cout<< "Enter the type: ";<br />
getline(cin, books.type);<br />
<br />
<br />
return 0;<br />
}
|
|
|
|
|
klutez123 wrote: But I have to use pointers...
Why? They are not necessary for what you are doing.
klutez123 wrote: card_catalogue books;
Should be:
card_catalogue books[5]; You then need to wrap your cout /cin statements in a for loop.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i couldn't catch what you exactly want, but can a constructor help you?
you could create a constructor that takes these values as argument and get the values one by one from console. then, create a new books struct with the values.
|
|
|
|
|
Hello!
Please, help me with such question,
how I can save BLOB object in Oracle Data Base through stored procedure?
I use vc++.
Thanks.
|
|
|
|
|
Can any one send me some sample project using TCP IP Chat project
S.Yamini
|
|
|
|
|
|
I tried to implement a chat server and client application using TCP/IP in VC++. but the connect function is not executing in client exe and accept is not executing in server exe.If u have any sample codes or links or suggestion plz send me
S.yamini
|
|
|
|
|
yaminisridaran wrote: but the connect function is not executing in client exe and accept is not executing in server exe
So, what does that mean ? That's a quite vague explanation of the problem.
yaminisridaran wrote: If u have any sample codes or links or suggestion plz send me
Did you search on codeproject for examples of socket connections ? I think there are quite a lot of articles on that subject.
|
|
|
|
|
Have a look at MSDN samples CHATTER and CHATSRVR here[^] to compare what you've done.
If you still don't get it to run properly, you have to follow Cédric's advice and describe your problem more clearly.
What does e.g. "the connect function is not executing" mean? Does it not get called? Some code snippet at that point would also help us to help you.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I would like to help you....
but you make it very hard. Many of your past postings are unspecific or from the kind "send me a complete solution because I don't like to search for them myself". However, I am working with networking applications and if I see a specific question about networking/sockets/protocols I am very happy to help (that is if Mark S is not answering faster).
Cheers and happy programming!
|
|
|
|
|
Moak wrote: that is if Mark S is not answering faster
Me? I'm sloooow. It looks like this one's covered to me!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: Me? I'm sloooow. It looks like this one's covered to me!
This time my coffee break was before yours
|
|
|
|
|
It's 9am here... I'm not even half-caffeinated yet
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
grab a copy of Yashwant kanetkar's "VC++ Gems" . he gives u step by step approach for C/S coding in vc++ using CSocket .
If you do not want CSocket(MFC) , search for "Simple TCP Server" by Nishant in codeproject
redindian
|
|
|
|
|
Hi all,
i'm trying to isert a new item to the tree control when i click on a button.It's working fine if i'm inserting the new item as a child to the another item which is already having child items,but when i try to add the new item to a leaf item (leaf item as parent to the new item)new item is inserted but not visible.
How can i come out from this problem.Any one please help me .
Thanks in advance.
|
|
|
|
|
Try calling - YourTreeCtrl.Expand(hParent, TVE_EXPAND)
where "hParent" is the leaf which is now the parent of the new item
|
|
|
|
|
Thank you for your reply Mr GuyM
I already tried in this manner but the item was not visible .Any alternative to this .
|
|
|
|
|
//I have a problem reading a text file which I have
//created using Notepad and saved at c:\test.txt in
//"Unicode" format.
//The file contains just a single word: "Test"
//The following is a C++ program to read the file
#include <wchar.h>
#include <fstream>
using namespace std;
typedef basic_ifstream<wchar_t> ifs;
void main () {
ifs is ("c:\\test.txt");
wint_t c;
while ((c = is.get()) != WEOF) {
wprintf (L"%c", c);
}
}
//The output was:
//..T.e.s.t.
//Note that the loop went for 10 times while I expected it
//to run only 4 times for word "Test".
//The following is an equivalent C program that does all correctly.
/*
#include <stdio.h>
void main () {
FILE *fp = _wfopen (L"c:\\test.txt", L"rb");
wint_t c;
while ((c = fgetwc(fp)) != WEOF) {
wprintf (L"%c", c);
}
fclose (fp);
}
*/
//Output: Test
//Do you have any suggestions? Please help. Thanks in advance!
B2C
|
|
|
|
|
balu_codeproject wrote: typedef basic_ifstream ifs;
Try:
typedef wifstream ifs;
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for your help! I hope the problem is solved.
|
|
|
|
|
Unicode Text File c:\test.txt contents:
"Test" (without quotes).
wchar_t is defined as unsigned short as it should be.
typedef unsigned short wchar_t;
But wifstream which is defined as
typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
cannot read unicode file correctly.
#include <fstream>
using namespace std;
void main () {
wifstream is ("c:\\test.txt");
wchar_t c;
while ((c = is.get ()) != WEOF) {
wprintf (L"%c", c);
}
}
output was:
..T.e.s.t.
When I tried short instead of wchar_t all went ok;
#include <fstream>
using namespace std;
void main () {
typedef basic_ifstream<short, char_traits<short> > ifs;
ifs is ("c:\\test.txt");
wchar_t c;
while ((c = is.get ()) != WEOF) {
wprintf (L"%c", c);
}
}
output was:
Test
Should wchar_t be defined as short or this is a bug
in standard C++ library shipped with VC++ 6.0?
B2C
|
|
|
|
|
Hello, i'm fairly new to c++ and programming in general, I'm looking for a decent alternative to microsoft visual c++ 2005 express edition, that is, any code that would work in that compiler would function the same.
I've already tried dev c++ but that uses mingu? So my code comes out with lots of errors when I compile, is there a free compiler that I can download that uses the same standard as express edition?
The reason that I am looking for an alternative is I'm experiencing some difficulty with running express edition in windows vista, I'm a college student studying programming so I need a compiler that works for my studies.
|
|
|
|
|
spacegrass wrote: So my code comes out with lots of errors when I compile
What kind of application did you use ? console ? Win32 ? Normally, this should work with DevC++. What are the compilation errors that you get ?
|
|
|
|
|
I am not an expert about Vista, but IMHO if you experience troubles with MS compiler, then probably you will experience more troubles with other ones.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|