Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thanks for that suggestion :)

Click Here

Oops! It doesn't seem to work so well afterall. I used the editor from here. Looks ok on their web site and looks ok when I just double-click the file on my computer (using ACDSee to view it).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You ain't seen "weird" yet :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can put your code anywhere you want. When you create a new project it asks for the project name and location. I don't like that long path so I always put my source code in c:\dvlp folder. Makes it very simple to find that way.

This project is out of date

I got that occasionally too -- just let it rebuild and you can then run the program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes it is similar. At one time CLR/C++ didn't support fstreams, but obviously that is no longer the case. I also may have just been incorrect when I said that (wouldn't be the first time :) )

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

VS++ defaults to 32-bit compiles. If you want to compile for 64-bit you have to use the configuration manager to change it (the text box that says win32).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is it possible to post equations that look like equations? I mean something like the Lensmaker's equation in this wiki article If yes, how?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The formula is given in this wiki article. Doesn't look like "simple programming" can be used.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I compiled with VS 2012 (not VS 2013) and ran ok on the computer that doesn't have vs installed. The only change I made to the file you posted was added using std::ofstream; after the two includes at the top of the file. I used the File1.cpp my compiler generated instead of the one you posted, then added the few lines that you posted.

There are several sets of redist DLLs, I used the ones in redist/x64 folder because the target computer has 64-bit version of Windows 7. The program itself is compiled as 32-bit program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is the ip address, user ID and password correct? I hope you didn't actually post the correct password.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I put them in the same folder as the executable. Can you post the entire program you are tring to run and I will try to make it run on my computers? If not, can you replicate the problem with the code I posted earlier?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes that is the right place. You need at least the DLLs in "Microsoft.VC100.CRT". The others are for specific types of programs, such as MFC and ATL.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you are beginner, don't expect to get any of the best jobs, instead just get any job you can find. You have to pay your dues before landing any of the best jobs.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There's something else wrong -- the warnings you posted don't correspond to the code you just posted. There is nothing wrong with those two printf() statements. What exactly are lines 151 in open_file.c? Better yet, just post the entire code in open_file.c.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do it just a small piece at a time -- don't get overwhelmed by the complexity of it all.

First, change line 15 to get the number into a simple variable instead of into the array.

After that is done, create another loop to search the array for the value entered on line 15. When you get that finished, post the code you have written so we can see it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

if someone could help with at least part of it

You mean you want us the translate the entire program? What exactly do you mean by "last part"?

andreagonz9 commented: Hi, sorry for the confusion. I am having problems with all of the code, I'm teaching myself how to use assembly language by reading the theory from a book; and have not been very succesful. translating everything would be to much to ask, do I just need at +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did your instructor explain what "read" means? Does it mean read the numbers from a text file, or get the numbers from the keyboard?

On line 15 you should read a number into a simple integer variable instead of directly into the array. The reason is that after getting the number the program has to search the array to see if the number is already in it. If it is, then just go on to the next number. If the number is not in the array, then add it.

You search an array in a simple loop. If the loop counter is variable named i, then check the ith value in the array against the number just entered.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i need the whole c++ programming code

Not going to happen. Please post the code you have tried and we'll help you fix it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I tested on a computer that does not have VS installed and it worked without a problem after installing the Microsoft redistributable DLLs.

#include "stdafx.h"
#include <fstream>
#include <iostream>
using namespace System;

int main(array<System::String ^> ^args)
{
    std::ofstream out("Text.txt");
    if (!out.is_open())
    {
        std::cout << "Cannot open file\n";
        return 1;
    }
    out << "Hello World From fstream\n";
    Console::WriteLine(L"Hello World");
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to put pragmas around unmanaged code. The only way to find out if it will fix your problem is for you to test it on the computer that does not have visual studio.

[edit]I don't have VS 2010, but VS 2013 compiles and works ok without the pragmas on the computer that has vs installed, just as you reported. I don't have a computer without VS so I can't test that part of your problem.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Can you see the program in the Services program? (Search for "Services" then select the item "View Local Services")

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Study some of these links on how to mix managed and unmanaged code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Scan your computer for visuses and malware. What version of MS-Windows are you running?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to use two different clock_t variables, such as t1 and t2. set t1 before doing anything, such as on line 27, then set t2 after finishing, such as on line 50. Then just subtract the two. But, be warned that computers are very very fast so the difference is likely to be at or close to 0.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post the code you have tried. If you are not allowed to use a loop then do it with recursion (a function that repeatedly calls itself)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have no idea what you just asked. There's no such thing as "ShowWindow api".

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How smelly is durian? Here's a youtube video.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

strlen() will only return the length of the string, not the number of bytes allocated to the pointer. So if malloc allocates 1000 bytes, but you only copy "Hello" into the memory, strlen() will only return the number of characters in "Hello", not 1000. There is no standard C function that will return the number of bytes allocated to the pointer which is why you need to save it yourself in another integer if you need it later for something.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The only reason I upgraded from 2012 to 2013 was because the cost of the upgrade was so cheap. I'm not in the business of writing professionally any more, so I'm not concerned about not having the latest-and-greatest any more. Leave that up to the younger generations :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is the version of MS-Windows the same on both computers? What error message(s) do you get when you try to run the program on the computer that does not have the compiler installed? I'm thinking you might also have to install some of the "redistributables" files. Look in the compiler's install directory, there should be a folder named redist. On my computer it's here: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist. If you can't find this then I think you can download the files from Microsoft site.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think TrackArray should be a 2d array, first dimension is the number from array[] and the second dimension is the count. So all you have to do is iterate through array[]. For each value in array[] search the first dimension of TrackAwway to see if the number is already in TrackArray. If it is, then just increment the second dimension counter. If it's not in TrackArray then add it to the first dimension and set the corresponding second dimension to 1.

This semi-sudo code assumes you write a function called search() that searches TrackArray for the value in array[i] and returns either -1 (not found) or the index in TrackArray where it was found.

for(i = 0; i < SIZE; i++)
{
    int found = search(TrackArray, array[i]);
    if( found < 0)
        Add to TrackArray
    else
        increment TrackArray[i][1];
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I am trying to calculate the size of char *

sizeof() won't give you what you want, all sizeof gives you is sizeof(char*), not the number of bytes allocated to the pointer. All 32-bit compilers on MS-Windows and *nix machines sizeof(char*) is a constant value of 4, same as sizeof(long).

The only way sizeof will work for you is to do something like this:

char vertices[1000] = {0};
printf("sizeof(vertices) = %d\n", sizeof(vertices));
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

When you copile for debug the compiler uses the debug version of windows dlls instead of the standard non-debug version. So if you move your debug program to a compiler that doesn't have Visual Studio installed the os will not contain the debug version of the DLLs. You have to re-compile programs for Release mode before copying them to other computers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You'll have to post how you use that. If the = operator is invoked then line 9 of the code you posted with replace the value set in line 3.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

but can i do these?

Not if you are using the VARIANT from windows.h. If you aren't doing any COM stuff (which you probably are not), then use the types described by Mike, above.

cambalinho commented: thanks +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Below is a simple example. Here is a complete list of vt types. Of course if you create your own class then you can do whatever you want by making up your own type code macros.

#include <windows.h>

void foo(VARIANT* vt)
{
   switch(vt->vt)
   {
        case VT_EMPTY:
        case   VT_NULL:
            break; // nothing to do
        case   VT_I2:
            cout << "Short Integer: " << vt->ival << '\n';
            break;
        case   VT_I4:
            cout << "Long Integer: " << vt->llval << '\n';
            break;
        case   VT_R4: 
            cout << "float: " << vt->fltval << '\n';
            break;
        case   VT_R8:
            cout << "double: " << vt->dblval << '\n';
            break;
   }
 }


 int main()
 {
    VARIANT vt;
    VariantInit(&vt); // initialize the VARIANT
    vt.vt = VT_I4;
    vt.llval = 123;
    foo(&vf);
}
cambalinho commented: thanks +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't think so -- all it mentions is cheap upgrad from 2012, most likely because 2013 was released so quickly after 2012.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

windows.h already contains a variant structure (link here). All it is is an union of a lot of objects, and an integer to indicate the type of object that is used.

Here is a simplified version of it, the data members in windows.h do not have the same names as in my code below, but it's the same idea.

struct variant
{
   int vt;
   union
   {
       char*ptr; 
       short sdata;
       unsigned short usdata;
       int idata;
       unsigned int uidata;
       long ldata;
       unsigned long uldata;
       void* unknownptr;
    };
};
cambalinho commented: thanks +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't know of any way to do that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Microsoft is ALMOST giving this away to people who already own VS 2012 Pro -- just $99.00, compared to $400.00 price without VS 2012 Pro. There were a few changes to .NET Framework, closer compliance to C++11, and better support for writing Windows 8.1 apps. If you don't care about any of those then it's probably not worth the $99.00 to upgrade.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

"The array length is %c %c \n

That doesn't print the array length. It prints the character at the ith element in each array. The two are not the same things.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Text files can not be changed directly. Read the file into memory, make changes in memory, then rewrite back to the file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is no similar standard MS-Windows program. see this list and these google links

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have not tried it with a browser app, but win32 api CreateProcess() allows you to start a process with SW_HIDE attribute.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read the data into an array instead of directly into a grid or something else, move the suffix's (A, B, etc) into another column so that the first column is only numeric, sort the array treating the first column as numeric instead of string, then move all data to it's final destination. This also means there is no point in having the datatable sort the data.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The nice thing about Microchip programs is you can CTRL click on the defined word and the program will bring up the file that defined it.

Visual Studio does that too -- very handy feature :) Other than that, I can't tell you what the problem is because I don't have your compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

When you created the project did you tell the wizard to use precompiled headers or did you uncheck that box? If it was left as the default (checked) then all *.cpp files must include stdafx.h as the very first include file. If the project contains any *.c files then you need to tell VS that they do NOT use precompiled headers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Please post revised code that corrrects problems mentioned previously.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since you are beginner, go through this free tutorial. When you are finished you will be able to answer your own question.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

int16_t must be defined somewhere -- I don't see it defined in any of the code you posted. Check the other included files. I don't know anything ab out XC32, but it may not be standard c or c++ complient since it's intended for embedded programs.