?
Solved

conversion of pascal to c

Posted on 2004-03-20
7
Medium Priority
?
484 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 11

Accepted Solution

by:
Jase-Coder earned 1000 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 101

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 101

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 101

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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

WooCommerce is becoming the most powerful e-commerce plugin for Wordpress. And why not. The platform comprises of numerous core plugins that may come in handy, powerful options to make your website development task much easier.
What monsters are hiding in your child's room? In this article I will share with you a tech horror story that could happen to anyone, along with some tips on how you can prevent it from happening to you.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

650 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