Solved

conversion of pascal to c

Posted on 2004-03-20
7
471 Views
Last Modified: 2010-04-16
hi
In the program posted before

 http://www.experts-exchange.com/Programming/Programming_Languages/Pascal/Q_20920285.html

I have problems in converting the followiing to c.p2c was giving some stnage error.If anyone of u trythe code in p2c and tell me what is the problem that would be great.Anyway I started to convert it manualy and i just wanted to know the equivalent code in c.If u want to know more abt the procedures refer to the code in the above thread
1
 unit allint;
interface
uses crt,dos,printer,lpvars,stackm;
what is the equivalent header for this in c

2.
PROCEDURE CreateLpLabel(i:integer);
VAR kf,kr,l,m,n:integer;
when i convert the above procedure into a c function wat about the variables l,m,n......it shuld be passed as paramters or does it mean some other thing

3. procedure AllIntegerGomory;

implementation

and
LpLabels[i] = Copy(Spaces,1,kf) + Copy(SymTab[Variables[i]].lexeme,1,m)
                 + Copy(Spaces,1,kr);

how this should be converted to c????????

thanks
ganesh
0
Comment
Question by:reachganesh
7 Comments
 
LVL 11

Accepted Solution

by:
Jase-Coder earned 250 total points
ID: 10645149
1:

#include <stdio.h>
#include <windows.h>

2:
void CreateLpLabel(int i)
{
   int Kf, Kr, L, M, N;

} the above variables only need to be passed as parameters if they are to be used in another part of the program.

3:
 void AllIntegerGomory(void);

4:
  use the functions: strcpy() and strcat()
0
 

Author Comment

by:reachganesh
ID: 10645420
Hi there
I was trying to use the p2c converter in this site  http://www.garret.ru/~knizhnik/pascal.html to convert the entire program but it did not work.Can you please have a look at this link(windows version) and tell me how can i use it to convert the code to c.Plz try to use the pascal code in this post
 http://www.experts-exchange.com/Programming/Programming_Languages/Pascal/Q_20920285.html  and lemme know what is the problem
thanks
ganesh
0
 

Author Comment

by:reachganesh
ID: 10646425
hi there
What is the difference between procedure and funciton in pascal Will there any difference in converting them to c .I see some of them starting with the begin kayword but some doesn't
PROCEDURE ALLintegerALG;

VAR  C, DENUM,I,J,K,L,NP,NUM,R,R1,S,T : INTEGER;
     kprt,lprt,jprt : integer;
     B, ITER : BOOLEAN;

-------------------------------------------------
FUNCTION EUCLID(U,V :INTEGER):INTEGER;
  VAR W : INTEGER;
  BEGIN
thanks
ganesh
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 100

Expert Comment

by:mlmcc
ID: 10664424
The difference between a procedure and function is a function returns a value and can be used in an expression.  A procedure stands alone.

Procedures translate to VOID functions in C.
The begin keyword provides when the code for the function starts.  AllintegerALG has a begin it is quite far below the header.

Pascal programs have a much different syntax from C program thus your problem in converting.

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10801151
This question has been classified abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.

Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help.jsp#hs5

mlmcc
0
 

Expert Comment

by:joseph789
ID: 10861444
Can i see some tutorials of Visual basic? The should include Objects, Windows programming, components and file handling
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10865586
joseph789 - Please ask your own questions.  Also it would be better if this question were asked in the Visual Basic forum.

mlmcc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In 2017, ransomware will become so virulent and widespread that if you aren’t a victim yourself, you will know someone who is.
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now