Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: SDowd
  • Order by date
  1. SDowd

    ANSI C structures, how to pass a value to

    it is an array
  2. SDowd

    ANSI C structures, how to pass a value to

    As a note, the extra param of "4" in the call to scanf is not necessary.
  3. SDowd

    pass a string to a function

    i agree it would be easier to use CString. And as for the " = {0}" compiles and runs for me. VS 2010 express char* someCharArray = {0}; printf("someCharArray(%s)\n", someCharArray); with output of: "someCharArray = ((NULL))"
  4. SDowd

    ANSI C structures, how to pass a value to

    i changed "thename" to a char array and it worked for me: // Test.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> //struct definition struct sample { char *name; char *addr; char *city; char *state; char *zip; char *phone...
  5. SDowd

    ANSI C structures, how to pass a value to

    Did any of that help fix it?
  6. SDowd

    ANSI C structures, how to pass a value to

    print out "thename" as soon as you do your scanf. move the struct above the definition of "int main." Include the default constructor with the initializer list. in main: sample Asample; //instance of defaulted struct ... printf("Enter Name"); scanf("%s",thename); //verify "thename"...
  7. SDowd

    ANSI C structures, how to pass a value to

    after these lines: printf("Enter Name"); scanf("%s",thename); add printf("thename = %s\n", thename); see if you can see what the actual value is prior to doing anything with the structure.
  8. SDowd

    ANSI C structures, how to pass a value to

    also, you may want to create a constructor for the struct which defaults the members: struct sample{ char *name; char *addr; char *city; char *state; char *zip; char *phone; //constructor with initializer list(everything to 0)...
  9. SDowd

    ANSI C structures, how to pass a value to

    same as in the other post: char* thename = {0}; try defining the struct outside/above the definition of main
  10. SDowd

    ANSI C structures, how to pass a value to

    char thename will only accept a single char, you would need to make it a char array or a char*. http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
  11. SDowd

    pass a string to a function

    char* newphrase = {0}; //zero out the memory then after that, it would depend on what youre actually trying to do with the function. the original post says translate the phrase. translate how? what are the desired results? obviously to create and return a new string, but with what...
  12. SDowd

    Using ADO.Net in C++ Visual Studio 2005

    a quick google search("ado.net c++") returned this: http://www.codeproject.com/KB/mcpp/adodemo.aspx http://www.codeproject.com/KB/database/adonet_mcpp.aspx
  13. SDowd

    pass a string to a function

    sorry.. newphrase will be populated with nothing but "A"s whenever a space is found. so it should return a char* populated with "A"s
  14. SDowd

    pass a string to a function

    well as your code reads: You populate newPhrase with nothing but ' ' (spaces). then you return the newly build "newPhrase" which is some length of nothing but spaces. sk2 holds all of the characters that arent spaces(built but not used). what is the desired result of this function?
  15. SDowd

    pass a string to a function

    how did you fix it?
  16. SDowd

    pass a string to a function

    :-)
  17. SDowd

    pass a string to a function

    let us know how you fixed it, so everyone can see the solution.
  18. SDowd

    pass a string to a function

    have you tried using the copy method of the string class? http://www.cplusplus.com/reference/string/string/copy/ or you could also do a memcpy: http://www.cplusplus.com/reference/clibrary/cstring/memcpy/ where you would get your length/size via sizeof(your char*)/sizeof(char). will give you...
  19. SDowd

    Array Blues, how to set words to array elements

    Your array type is "char." Char takes a single character, while your trying to push in actual strings. you would either need to make the type of wordarray char*, or CString, or the always fun array or char arrays.. wordarray[][]. Also it should be noted that strings need to be encapsulated...
  20. SDowd

    Help me with this error!

    you declare: string getRandomSecretWord(const string& = "secretwords.txt"); and then define it as: string getRandomSecretWord(int secret_word_counter,const string& file_name) { ifstream secret_words; string secret_word; so your declaration says it should expect 1 paramter(or zero...

Part and Inventory Search

Back
Top