Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

marinme

@marinme
About
Posts
10
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • quick bind1st question
    M marinme

    I am trying to use this:

    for_each(stringname.begin(),stringname.end(),bind1st(MyFunctionName, Arg2);

    this is not passing Arg2 to MyFunctionName(Arg1, Arg2).. I am getting the following errors: error C2825: '_Fn2::second_argument_type': cannot form a qualified name error C2039: 'second_argument_type' : is not a member of 'operator``global namespace''' I can implement this easily as a functor if I make a class for it, but I thought you could use a function and just use it's name without any arguments using bind1st... am I wrong? Thx.

    ATL / WTL / STL question help

  • String output to ofstream object
    M marinme

    thanks very much! that's what I was looking for

    C / C++ / MFC help question

  • String output to ofstream object
    M marinme

    well, that would work using the CString class, but I'm trying to use the typedef'd string class from basic_string<char *> I believe it is in the <string> header file... I've never used the CString class(that I know of, and I'm trying to stick to using the one I'm used to.. It doesn't work using

    #include <string>
    basic_string<char *> myString
    myOutputFile << myString;
    
    C / C++ / MFC help question

  • String output to ofstream object
    M marinme

    Hello! I'm having a problem writing string objects to a file. I just learned file I/O and am not quite sure what the problem is. I am using a string object (basic_string<char *> ) and it doesn't seem to like what I am doing. here is some sample code:

    #include <fstream>
    using namespace std;
    #include <cstring>
    
    ofstream myFile("file.txt");
    
    int main()
    {
       string myBuffer("Some text");//from the std namespace
       myFile.write(myBuffer, myBuffer.size());
       myFile.close();
       return 0;
    }
    

    this does not like my string going into the file. I have also tried the extraction operation << with it, but it says it is not defined... I thought the function fstream & operator<<(string & someString) was defined in the string class... any help?

    C / C++ / MFC help question

  • Little doubts
    M marinme

    -c wrote: (1)is 'int* x' same as 'int *x' it works the same, but some people prefer one over the other to remind them it is a pointer to int, not int pointer. -c wrote: (2)'char const* x' same as ‘const char *x’ char const * x;//this is a constant pointer to a char type const char * x;//this is a pointer to a constant char type

    C / C++ / MFC c++ help question

  • simple program
    M marinme

    you still have yet to assign fp as was stated above

    C / C++ / MFC question

  • How to make a project that is opened as its own program
    M marinme

    sounds like you just want to build a project rather than just compile it.... what compiler are you using?

    C / C++ / MFC csharp visual-studio tutorial

  • Compile/Link Work, Code Doesn't
    M marinme

    What's the error message you are getting about that line?

    C / C++ / MFC c++ help question

  • Private inheritance question
    M marinme

    I'm trying to make a class using private inheritance from two template classes. I've made my own String class(I'm learning from a book and it has you do this), my own Array class. the Array class is a template class, and I am using it to take a type of another template class that takes two arguments. class Class_name: private Array< other_class >, private String { public: Class_name(int l = 10); ~Class_name(); void Set(int in = 0); //takes index for array private: const int len; //length of array }; the only definition that I think is relevant is the Set() method void Class_name::Set(int in) { //take input from user to pass to array } in this member function, I'm not sure how to call the template class type of the array's function. using containment, I can just set a variable of array type in it and call the function using the [] operator as a reference for the class... Thanks for your help, please let me know if I'm too vague

    C / C++ / MFC learning database data-structures oop help

  • newbie needs help
    M marinme

    Hello, I'm currently trying to learn c++ and stuck on an exercise from my book. I don't have an answer guide, nor can I find the answer online. Here is the exercise: Design a structure called car that holds the following information about an automobile: its make as a string in a character array and the year it was built as an integer. Write a program that asks the user how many cars to catalog. The program then should use new to create a dynamic array of that many car structures. Next, it should prompt the user to input the make (which might consist of more than one word) and year information for each structure. Note that this requires some care, for it alternates reading strings with numeric data (see Chapter 4). Finally, it should display the contents of each structure. A sample run should look something like the following: How many cars do you wish to catalog? 2 Car #1: Please enter the make: Hudson Hornet Please enter the year made: 1952 Car #2: Please enter the make: Kaiser Please enter the year made: 1951 Here is your collection: 1952 Hudson Hornet 1951 Kaiser And here is my code: #include using namespace std; struct car { char make[30]; int year; }; int main() { int carsToLog, i; cout << "How many cars do you wish to catalog? "; cin >> carsToLog; car * pNum = new car[carsToLog]; for (i = 0;imake,29); cout << endl << "Please enter the year made: "; cin >> pNum[i]->year; } cout << endl << "Here is your collection: " << endl; for(i=0;iyear << " " << pNum[i]->make << endl; delete[] pNum; return 0; } I am getting the following errors from VS.Net: error C2819: type 'car' does not have an overloaded member 'operator ->' error C2227: left of '->make' must point to class/struct/union. When I take the array index out of the cin lines, it works, but will only access the first index of the dynamic array.. Thanks for the help in advance!

    C / C++ / MFC help csharp c++ database visual-studio
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups