User Profile

Collapse

Profile Sidebar

Collapse
DavidKrutsko
DavidKrutsko
Last Activity: Jan 3 '08, 09:29 AM
Joined: Aug 1 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • DavidKrutsko
    started a topic Challenge - Manually opening a file....
    in C

    Challenge - Manually opening a file....

    Hey,

    Can anybody help me write a function to open files (aka same thing as fopen) but without using any hidden libraries (aka fclose.c... and so on) and without using the cheap microsoft .net stuff.... just the simplest way of writing it and still be effiecient.... thanks

    by the way... I looked at the stuff from fopen and have no idea what most of it is suppost to do lol...

    P.S. this is PURLY PRACTISE...
    See more | Go to post

  • DavidKrutsko
    replied to Small problems formatting maps (<map>)
    in C
    *SOLUTION*

    Alright i was thinking about this for a long time and figured out what i can do.... here is what i did....

    Code:
    #define Number 8
    typedef char* pChar;
    
    // converts a string into a pChar
    pChar StrpChar (string InStr)
    {
    	return _strdup(InStr.c_str());
    }
    
    // Converts integer into a pChar
    pChar StrInt (__int64 InNum)
    {[INDENT]
    ostringstream[/]
    ...
    See more | Go to post

    Leave a comment:


  • DavidKrutsko
    started a topic Small problems formatting maps (<map>)
    in C

    Small problems formatting maps (<map>)

    Hey,

    consider the following chunk of code

    [CODE]
    #define CONSTANT 5

    void func (const char *Code)
    {
    map <pChar, pChar> Codes;
    Codes["A100"] = "SOMETHING\ n";
    Codes["A101"] = "ANOTHER SOMETHING", CONSTANT, "\n";

    if (Codes.find(Cod e) != Codes.end())
    fprintf_s (stderr, Codes
    Code:
    );
    	else
    ...
    See more | Go to post

  • DavidKrutsko
    replied to strcmp multiparam second opinion
    in C
    solved!!!

    make key optional by issuing it a defauly parameter then checking to see if its NULL or not... if yes then read it if its NULL then ignore and more on....
    See more | Go to post

    Leave a comment:


  • DavidKrutsko
    started a topic strcmp multiparam second opinion
    in C

    strcmp multiparam second opinion

    Greetz,

    i just need a second hand opinion from other people....

    say i have a function [-Encrypt Key] but the Key part is optional....

    the way i have it layed out now is

    Code:
    if (strcmp (argv[i+1], "-InFile /*or another argument*/) == 0)
    so basically check next argument to see if its another argument instead of the key.... if it is then use defualt key, if not then read it...
    See more | Go to post

  • DavidKrutsko
    started a topic Pointing to specific parameter....
    in C

    Pointing to specific parameter....

    Any quick way to point to a specific parameter instead of by its name.... example

    void func (char nameA, char nameB)

    any way i can refer to them direct aka like param 1, param2, or first, second, etc...
    See more | Go to post

  • DavidKrutsko
    started a topic # of parameters
    in C

    # of parameters

    How can i (inside a function) read how many parameters were passed to it....

    (if your saying thats easy you should know when writing the functions i suggest you look into --> va_arg, va_end, va_start <-- inside <stdarg.h>)

    thanks,
    See more | Go to post

  • DavidKrutsko
    started a topic Parameter overdrive.....
    in C

    Parameter overdrive.....

    Hey i have a rather wierd question....

    say i have a function that compares strings that looks like the following when used in code:

    Code:
    if ((StrComp (some char* here, another char* here)) [.......]
    1st param is 1st string and 2nd is what the 1st is being compared to..... if they are the same then true else false....

    now i have a group of strings i want to compare and i dont want to write like...
    See more | Go to post

  • DavidKrutsko
    replied to Simple typedef question......
    in C
    alright thanks, ive been actually thinking about it and yeah i kinda agree.... no point since cout will only use it....
    See more | Go to post

    Leave a comment:


  • DavidKrutsko
    replied to Simple typedef question......
    in C
    um alright well...

    typedef unsigned char byte;

    but of cource when i define a variable with byte it gives me characters rather than numbers for example:

    ------------------------------------------------------------
    #include <iostream>
    typedef unsigned char byte;
    using std::cout;

    main()
    {
    byte Value = 5;
    cout << Value;
    }...
    See more | Go to post

    Leave a comment:


  • DavidKrutsko
    started a topic Simple typedef question......
    in C

    Simple typedef question......

    Hey,

    is it possible to typecast inside typedef, for example:

    typedef char DEF

    but instead of displaying definition as a character and NOT having to typecast later on (aka DEF something = 5; cout << (int)something; )

    is there any way to typecast right at the beggining at the typedef stage....

    thanks,

    P.S any clever alternatives to this welcome..... as long...
    See more | Go to post

  • DavidKrutsko
    replied to Indexing .txt files in c++
    in C
    Well needing to know the format of the file kinda eliminates of what im really trying to do....

    if you look at the Half life 2 gameinfo.txt and weapon scripts (well practically the whole game definition system) you would see that there is no format and everything is very random.....

    here i found a wikipedia entry to help me but im still kinda unclear about this whole topic...

    http://en.wikipedia.or g/w...
    See more | Go to post

    Leave a comment:


  • DavidKrutsko
    started a topic Indexing .txt files in c++
    in C

    Indexing .txt files in c++

    Hello,

    although this question has probebly been answered a bunch of times i couldent find the answer im looking for.... anyways what im trying to do is....

    Say i want to create a c++ program to read something from a file but i want the file to be in the following format...

    File.txt
    ----------------------------
    "Data"
    {
    "Data1" "546"
    ...
    See more | Go to post
No activity results to display
Show More
Working...