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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual C++ 6 and external programming 1

Status
Not open for further replies.

thierrypp

Technical User
Jan 17, 2006
16
CH
Hi, Good Evening,
Happy new year 2006!

I am writing you from Switzerland and despite the fact that I have been looking in literature about C++ and on line forums, it remains a problem that I would submit to you. I would be grateful of your help. I am far away from being an expert but indeed today ( I mean since days I am blocked by this ! )

I have to manage a project in C++ which is pretty well working and dealing with stocks of the company I work with while studying( import/export of mineral water and dispatching stocks).

My project is within a folder: folder00 [ let's call it so]

all *.cpp, *.h files...etc...

I have to modify only one *.h file
and one *.cpp file.

hd01.h
blo1.cp

==> for hd01.h, I have to modify line 5 to 22
and replace the block of numbers by a new block of numbers in a worpad file wpd01.rtf

==> same for blo1.cp [line 58 to 72] with wpd02.rtf

The path of each file is stable

How can I proceed from an external C++ executable file [ let's call it external.cpp]?

And how can I automatically rebuilt the project? From external.cpp too?

Thanks a lot,

Greetings,

TPP

 
I'm not sure what you mean by a block of numbers? Do you mean an array like this:
Code:
int iArray[] = { 0, 1, 2, 3 ...};
 
no,

in a typical worpad document ( *rtf)

it starts with "documents....."
document
123589
44445666689
452
1135
4456111
...
.
.
.

and ends with "document filled...."

the length of each line is not defined but less than 20 numbers

thanks a lot indeed!

TPP
 
Hi,

I know I miss a gap to reach a upper level in order to be more skilled.

Thank you for your kindness,

I compile on Visual C++ 6.0 from Ivor Horton book published by wrox in the USA. Pretty great book!

Best Regards,
TPP
 
I'm still not sure what you need to do?
From what I've read, you have a block of numbers in your .h and .cp files that you need to update with a new block of numbers from a .rtf file. Is that correct?

Maybe it would help me to understand if I knew what those numbers will be used for and how they are currently being used. As well as how the numbers are stored in the .h and .cp files, since it wouldn't compile if they were in the format you listed.

If you post some of the source code, use the [ignore]
Code:
[/ignore] tags for readability.
 
Yes, perfectly, it is correct:

for the *ccp file called FB02.cpp

the block looks like:

//data 3
{0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}
};


and for the *.h file

it looks like( codes for products identification):

//document and data
document
123589
44445666689
452888888
1135
4456111
...
.
<----------not exeeding 20 numbers per line----->
.
89745632123
//data filled


-------- however and maily, the big big problem is:

how to launch the procedure for building up a new executable file of this Visual C++ 6.0 projects from an other file?


Thanks a lot,

TPP
 
If you want to build a project from a different file you can use the msdev command line. For example, if your project is called "Numbers" and the workspace is "Numbers.dsw", you can build it at the command line like this:
Code:
msdev Numbers.dsw /make "Numbers - Win32 Release"
If you put that in a .bat file, you can call the .bat file from another program using the system() function.
 
thanks a lot!

Indeed I do not want to abuse of your time.

I understand that I miss a gap in mastering Visual C++ 6.0.

However if you have some time or an example, maybe you have a typical example how to select data from a txt file and sending it within a *.h file or *.cpp file?

Based on your example and with respect to your copyrights I will go on and improve my project.

Greetings

T.
 
If your .txt file is formatted exactly as it should be in the .h or .cpp file, you can just #include it like this:
Code:
#ifndef MY_HEADER
#define MY_HEADER

#include <string>  // or whatever header files you usually include.

class MyClass
{
public:
   MyClass();
...

private:
   int numbers[] = {
[b]#include "numbers.txt"[/b]
   };
};

#endif  // MY_HEADER
Of course numbers.txt would have to look something like:
Code:
  39054, 32215,
  65553, 89874,
  74653, ...
Do you have control over the format of the numbers in the .txt file?
 
thank you,

well ...I guess I will have to work hard on it.....

There is ideed a gap that I miss and even watching carefully on line..books...

Anyway, if you know a project in VC++ 6.0 managing finding files and importing in *.h or *.cpp, just zip it and send it to me.....

I thank you a lot and I must admit that experts like you, lead to know more and work harder.

It is a difficult subject and of course in real world, no school examples can mach with reality!

Best Regards,

T.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top