Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A program running Pin
Mark Salsbery29-Jan-07 11:02
Mark Salsbery29-Jan-07 11:02 
AnswerRe: A program running Pin
PJ Arends27-Jan-07 12:06
professionalPJ Arends27-Jan-07 12:06 
GeneralRe: A program running Pin
RomTibi27-Jan-07 20:29
RomTibi27-Jan-07 20:29 
AnswerRe: A program running Pin
Hamid_RT27-Jan-07 18:52
Hamid_RT27-Jan-07 18:52 
GeneralRe: A program running Pin
RomTibi27-Jan-07 20:29
RomTibi27-Jan-07 20:29 
AnswerRe: A program running Pin
Stephen Hewitt28-Jan-07 13:57
Stephen Hewitt28-Jan-07 13:57 
GeneralRe: A program running Pin
RomTibi29-Jan-07 2:15
RomTibi29-Jan-07 2:15 
QuestionTrying something new Pin
dellthinker27-Jan-07 7:37
dellthinker27-Jan-07 7:37 
Hi all. Im trying something new. Something yesterday gave me an idea that i could use it with more than one source file. So i created 2 source files and 1 header file to do all the including and bridging communication between sources.

Here's what i have so far.

Source 1
<br />
#include "include.h"<br />
<br />
int main(){<br />
	const SIZE = 100;<br />
	char msg[SIZE];<br />
	printf("Enter a file you'd like to read: ");<br />
	cin.getline(msg,SIZE);<br />
	if(!msg){<br />
		printf("File %s doesnt exist.\n",msg);<br />
	}<br />
	else{<br />
		printf("Reading file %s",msg);<br />
		readfile();<br />
	}<br />
	return 0;<br />
}<br />


Source 2
<br />
#include "include.h"<br />
<br />
void readfile(void){<br />
	char buffer[100]={'\0'};<br />
	ifstream file("test.txt");<br />
	while(file.getline(buffer, 100)){<br />
			Sleep(3000);<br />
			printf("%s\n",buffer);<br />
	}<br />
	file.close();<br />
	cin.get();<br />
} <br />


Source 1 is to check what type of file you want to read. And determines if its in the area or not. Then source 2 actually does the reading once source1 gives it the O.K. - But im getting errors like mad.

<br />
: error C2513: 'const struct tagSIZE' : no variable declared before '='<br />
: error C2275: 'SIZE' : illegal use of this type as an expression<br />
: see declaration of 'SIZE'<br />
: error C2057: expected constant expression<br />
: error C2466: cannot allocate an array of constant size <br />
: error C2133: 'msg' : unknown size<br />
: error C2275: 'SIZE' : illegal use of this type as an expression<br />
  : see declaration of 'SIZE'<br />


If i compile them individually they work fine. But together they seem not to like each other. How do i fix this? Thanx in advance.
AnswerRe: Trying something new Pin
Michael Dunn27-Jan-07 8:26
sitebuilderMichael Dunn27-Jan-07 8:26 
AnswerRe: Trying something new Pin
prasad_som27-Jan-07 17:41
prasad_som27-Jan-07 17:41 
Questionhow to execute other progams in c++ Pin
asp.netProgrammer27-Jan-07 6:47
asp.netProgrammer27-Jan-07 6:47 
AnswerRe: how to execute other progams in c++ Pin
CPallini27-Jan-07 7:15
mveCPallini27-Jan-07 7:15 
AnswerRe: how to execute other progams in c++ Pin
Hamid_RT27-Jan-07 19:03
Hamid_RT27-Jan-07 19:03 
AnswerRe: how to execute other progams in c++ Pin
#realJSOP28-Jan-07 0:47
professional#realJSOP28-Jan-07 0:47 
QuestionDisable standard menue items in MS-Office applications Pin
Peter Fritze27-Jan-07 5:00
Peter Fritze27-Jan-07 5:00 
AnswerRe: Disable standard menue items in MS-Office applications Pin
S Douglas27-Jan-07 23:29
professionalS Douglas27-Jan-07 23:29 
Questionvc++ Pin
jeevirajan27-Jan-07 4:12
jeevirajan27-Jan-07 4:12 
AnswerRe: vc++ Pin
Jonathan [Darka]28-Jan-07 21:20
professionalJonathan [Darka]28-Jan-07 21:20 
QuestionInitialization of static variable of enum type fails? [modified] Pin
tesujix27-Jan-07 2:46
tesujix27-Jan-07 2:46 
AnswerRe: Initialization of static variable of enum type fails? Pin
Michael Dunn27-Jan-07 8:47
sitebuilderMichael Dunn27-Jan-07 8:47 
Question How To Access sql-server and design a UI with vc mfc? Pin
sepehr_vision27-Jan-07 2:22
sepehr_vision27-Jan-07 2:22 
QuestionHow to convert a array of bitmap bits to a HBITMAP? Pin
ceejeeb27-Jan-07 1:24
ceejeeb27-Jan-07 1:24 
AnswerRe: How to convert a array of bitmap bits to a HBITMAP? Pin
Mark Salsbery27-Jan-07 7:40
Mark Salsbery27-Jan-07 7:40 
AnswerRe: How to convert a array of bitmap bits to a HBITMAP? Pin
Hamid_RT27-Jan-07 19:14
Hamid_RT27-Jan-07 19:14 
Questionhow to know what is the class name of the main frame window? Pin
bengz27-Jan-07 0:36
bengz27-Jan-07 0:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.